Lesson learned for today... On a Sales Order, the...
# suitescript
d
Lesson learned for today... On a Sales Order, the billaddress and shipaddress fields on the record basically exist only for convenience inside of NetSuite's UI. If you want to properly set these addresses, you need to do so using subrecords instead. So, doing this won't work. It will appear to because UI will show the new value, but...
Copy code
record.setValue({fieldId: 'shipaddress', value: shipAddress});
What you should do is this:
Copy code
var shippingAddress = record.getSubrecord({fieldId: 'shippingaddress'});
shippingAddress.setValue({fieldId: 'country', value: shipAddress.country});
And the other thing that surprised me was that, whether you want to get or create a subrecord, the function is getSubrecord, either way.
b
you may actually need to overwrite the shipAddress or billAddress if you change the address during beforeSubmit
netsuite doesn't always automatically update the text of that field if you make changes to the address subrecords
ss1 used to be worse regarding creating subrecords, there used to be separate methods to create or load an subrecord
t
There is an update, in 2020.1 regarding this
👍 1