I need to create a bunch (250+) of order detail lines, update the Release on each of those lines, and add a freight charge to each line. At the moment my data source is an Excel worksheet. I chose not to go the DMT route with this because while I’m adding 250+ lines, the system is adding a whole bunch of kit part lines. This makes it more complicated to update releases and add the misc charge via DMT since the line numbers I need to use in those subsequent processes aren’t sequential.
I’m adding my rows using api/v2/odata/IRP/Erp.BO.SalesOrderSvc/OrderDtls.
In a perfect world, the response from that call would be the record details for the record that I created. It’s not. The response I get will be the data from one of the component lines that the system created.
In a less than perfect, but ok, world, the record returned would the from the last component line created. I don’t live in that world either. In this experience, the system creates lines 2-11 and it returns the record for line 8.
My work around was to add a step after I create the order line to retrieve the order and then determine what the next line number will be. This worked, but caused the recipe to slow as the number of lines increased.
My next idea is to call a simple BAQ that gives me that maximum line number for the order instead of retrieving the whole order. This should minimize performance degradation as the number of lines grow.
Because of the seeming randomness of the record being returned when I create the line, I’m wondering if there’s a timing issue at play. Maybe if my Kit part has 20 components instead of 10, the system won’t be done creating all of those component lines when I query to find the last one.
If that’s the case, the only idea I’ve come up with to get around this is to query to find the number of component parts for the kit before adding the line and then calculating the next kit parent line number from that.
Anyone got any better ideas?