Jump to content

Add item to sales order


Recommended Posts

I have a query which pulls down a sales order which has existing line items. After the order is processed, I'd like to add a new line item to the order. (ex: adding the shipping cost)

I seem to have wrongly assumed I can use SalesOrderMod and then SalesOrderLineMod without a TxnID to add a new line. It seems SalesOrderAdd would be wrong since the SalesOrder already exists.


Can anyone help with proper syntax?

 

Screenshot 2024-03-05 at 9.49.40 AM.png

Screenshot 2024-03-05 at 9.42.51 AM.png

Link to comment
Share on other sites

You're missing the EditSequence element, which is required.

You need to set SalesOrderLineMod::TxnID to -1 to add a new LineItem to your SalesOrder. It's been awhile since I last did this: you may need to loop first to include the TxnID of the already created LineItems in your Mod request.

HTH!

Geoffrey Gerhard
Creative Solutions Incorporated

14000 Creekside Drive
Matthews, NC 28105
704.814.6852

Edited by Geoffrey Gerhard
Link to comment
Share on other sites

Hi Geoffrey -


Thanks for the reply! My understanding was using -1 deletes all the previous line items. Worst-case I suppose I can store exisiting line items, then delete all and add back but I am not QB saavy and worried there could be inventory or some other ramifications of delete. (discounts, tax, etc.)

I'll check EditSequence!

Link to comment
Share on other sites

Set the IncludeLineItems to true in your SalesOrderQueryRequest, which you'll need to get the current EditSequence value, and you'll have the SalesOrderLineMod::TxnID values in the Response.

Geoffrey Gerhard
Creative Solutions Incorporated

14000 Creekside Drive
Matthews, NC 28105
704.814.6852

Edited by Geoffrey Gerhard
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.