setValue() on fields in the shippingaddress subrec...
# suitescript
c
setValue() on fields in the shippingaddress subrecord (on an SO) should save when the SO saves right? I'm setting the fields in beforeSubmit but the saved transaction isn't showing the fields I've set.
b
is the
shipaddress
field not being set correctly
or are the actual fields on the subrecord not being set
c
The latter
in regards to the former, I'm not interacting with the shipaddress field.
b
are you using the
shipaddress
field in the ui to tell if the subrecord has changed
or are you actually examining the actual address subrecord
c
Yes, that's the field I'm using to visually confirm
b
edit the sales order in the ui and edit the address to see the actual address subrecord to confirm
c
After some poking around I can see the addresses I've been setting have all been saved but the shipaddress field is not set to the saved address
and the fields are being correctly set and saved on the subrecord
b
extra common for the address fields to not source correctly
the sure fix is to set the
shipaddress
yourself
the exotic fix is to use Record.removeSubrecord first
c
@battk it looks like this one line of code fixed the issue:
Copy code
soRecord.setValue({fieldId: 'shipaddresslist', value: ''});
the shipaddress now shows the values I set in the subrecord.
I got that from a SuiteAnswer - I don't know why that works, I think it forces the address to be added as 'custom' instead of 'new'.
typical NS, very obscure fix/workaround that you only find out by luck.