How to set Canadian address 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?
Rookie Asked on May 28, 2020 in SuiteScript.

Hi Lia, when on the execution are you setting the country? Have you solved this one yet? I’m happy to help.

on September 11, 2020.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor