does anyone know why setting the shipping address ...
# suitescript
n
does anyone know why setting the shipping address on a transfer order like this:
Copy code
rec.setValue({ fieldId: 'shipaddressee', value: 'Walmart WFS'});
            rec.setValue({ fieldId: 'shipaddr1', value: address1});
            rec.setValue({ fieldId: 'shipcity', value: city});
            rec.setValue({ fieldId: 'shipstate', value: state});
            rec.setValue({ fieldId: 'shipzip', value: zip});
          }
would not work? I also tried getSubrecord and setting that way without success i tried afterSubmit & beforeSubmit for some reason the shipaddr1 & shipcity are working but not the other ones
n
yes
I can see the address subrecord getting updated in the script
Copy code
var shippingAddressSubrecord = rec.getSubrecord({fieldId: 'shippingaddress'});
            shippingAddressSubrecord.setValue({fieldId: 'country', value: 'US'});
            shippingAddressSubrecord.setValue({fieldId: 'addressee', value: 'Walmart WFS'});
            shippingAddressSubrecord.setValue({fieldId: 'addr1', value: address1});
            shippingAddressSubrecord.setValue({fieldId: 'city', value: city});
            shippingAddressSubrecord.setValue({fieldId: 'state', value: state});
            shippingAddressSubrecord.setValue({fieldId: 'zip', value: zip});
            log.debug('shippingAddressSubrecord', shippingAddressSubrecord);
👍 1
I found the issue - you really need to load the record with isDynamic: true or else it will not work
thanks @David B
d
No worries. But I'm sure you can still do this in standard/static mode. Have a read of Chidi's article The SuiteScript Developer's Guide on NetSuite Subrecords
🙏 1