We are creating Sales Orders via SuiteScript. But...
# suitescript
s
We are creating Sales Orders via SuiteScript. But, when the customer has a canadian bill to address, it wants canadian taxes and, if we override the shipto address on the SO to a USA address, it breaks the script because it says that it is expecting different taxes. We tried setting the tax nexuscountry in the sales order record.create defaultValues but that does not seem to help. A previous question on this subject indicated that we should set the form, but in the UI, we use the same form for both USA and CAN orders and their taxes auto-populate correctly. Does anyone know how to override which tax nexus will be used for a sales order create process?
a
Are you creating this
Sales Order
record in standard or dynamic mode? Try dynamic mode and make sure you follow the same order of operations you do in the UI.
s
We are doing it in dynamic mode. When it saves, it actually clears the shipto address we specify and reverts to the default shipto address of the customer.
a
Your code adding the shipto address is the one to blame then, something is wrong there. There are two ways to add a Ship To Address to a Sales Order: 1- Custom Ship To Address that only live in the Sales Order Form/Record and never makes it to the actual Customer. 2- Adding the address to the Customer and then selecting it in the Sales Order Ship To Address. Those two methods are essentially different and the code is also different, even using different field ID (I don't remember from the top of my head the field ID).
s
We are currently doing it as #1 above. We will try the second option. Thank you,
a
I found an old function where I set the ship to address on a Sales Order and the code also sets the proper tax code for that address on each line.
Maybe that is something you want to try...
s
Do you mean the tax code on the line item? If so, not sure how that would help because it looks like the problem is that the sales order record is set for the wrong country. I found this https://stackoverflow.com/questions/36038580/tax-from-changed-for-nexus ...but the only solution was something about accessing the vendor first and that does not apply.
Seems like the same issue and he indicated that NetSuite have marked it as a defect which means it has gone to that black hole where all "defects" go, never to see the light of day.