QuickBooks Mod operations fail to insert line items in the correct order. This may occur for line items on Invoices, Purchase Orders, Sales orders when adding/updating line items. The request fails with the following error:
<PurchaseOrderModRs requestID="2" statusCode="3290" statusMessage="The item "XXXX-XXXXXXXXX" is placed in the request in incorrect order." statusSeverity="Error" />
To modify or add line items to QuickBooks objects such as Invoices, Purchase Orders or Sales Orders, QuickBooks requires that all line items be re-submitted in the same order in which they were initially inserted. Any new line items should then be submitted at the end with the LineMod's TxnLineId set to -1. Any line items that are omitted will be deleted.
To re-submit line items in the same order, the sequence in which they are initially inserted will need to be captured and stored somewhere such that on subsequent runs, the sequence can be re-retrieved in sorted order.
To generate the sequence, the QuickBooks response xml from the initial add request will contain each LineRet's TxnLineID which can be used as input to a Line Item Increment Map Function which will auto-increment for each occurrence and output the line number for each order line. This output line number should then be stored in a custom field that is associated with the line item source. The query from the source should utilize an ascending sort on the custom field that contains the line number.
More on the line item increment map function and other map functions are described at this link: http://help.boomi.com/atomsphere/GUID-1480111E-4FA1-4108-A577-3A07B15AFB3C.html