RE: Setting the country via SuiteScript


I have a Map/Reduce script that creates sales orders based on values in an external database.

This works great for orders shipping to the US, but occasionally this script needs to create orders for Canada.

When I create a Canada order in the UI, the address pop-up reloads after I change the country, and the whole SO entry page reloads after I save the address.

When I create the SO via script (dynamic mode) I get this unexpected error on save that, to me, implies it’s running into issues when trying to reload the form:

{"type":"error.SuiteScriptError","name":"UNEXPECTED_ERROR","message":"An unexpected error has occurred","stack":["nlapiChangeCall(NLRecordScripting.scriptInit:2214)","change_form_due_to_address_change(NLRecordScripting.scriptInit:13305)","validate_custom_shipaddress_change(NLRecordScripting.scriptInit:13357)","(NLRecordScripting.scriptInit:14302)","page_init(NLRecordScripting.scriptInit:14296)","nlapiChangeCall(NLRecordScripting.scriptInit:2214)","change_form_due_to_address_change(NLRecordScripting.scriptInit:13305)","validate_custom_shipaddress_change(NLRecordScripting.scriptInit:13357)","(NLRecordScripting.scriptInit:14302)","page_init(NLRecordScripting.scriptInit:14296)","nlapiChangeCall(NLRecordScripting.scriptInit:2214)","change_form_due_to_address_change(NLRecordScripting.scriptInit:13305)"...

Note that it’s not using a different Sales Order form so I can’t set the form before setting all other fields.
Does anyone know how to create Canada SOs via scripting?
PaulC Rookie Asked on September 3, 2023 in SuiteScript.
Add Comment
1 Answers

Is this a new Custom address being created on the Sales Order?

Are you able to share the code you have so far?



Intermediate Answered on September 5, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.