I am trying to set a few Custom Record Fields in a...
# suitescript
a
I am trying to set a few Custom Record Fields in a Custom Address on a Sales Order Transaction. I can see that the values are being passed in on the payload via Execution Log. However, these fields aren't showing on the Sales Order. I have confirmed that these are Free Form fields and are Address Type custom fields. Any suggestions?
b
what does your code look like
a
if ( typeof request.shiptoid == 'undefined' ) { // Get the address subrecord and set standard fields. var shipaddrSubrecord = theRecord.getSubrecord( { fieldId: 'shippingaddress' } ); if (typeof request['shippingaddress']['country'] !== 'undefined') { shipaddrSubrecord.setValue({ fieldId: 'country', value: request['shippingaddress']['country'] }); } shipaddrSubrecord.setValue({ fieldId: 'addressee', value: request['shippingaddress']['addr1'] }); shipaddrSubrecord.setValue({ fieldId: 'addr1', value: request['shippingaddress']['addr2'] }); shipaddrSubrecord.setValue({ fieldId: 'addr2', value: request['shippingaddress']['addr3'] }); shipaddrSubrecord.setValue({ fieldId: 'addrphone', value: request['shippingaddress']['addrphone'] }); shipaddrSubrecord.setValue({ fieldId: 'city', value: request['shippingaddress']['city'] }); shipaddrSubrecord.setValue({ fieldId: 'state', value: request['shippingaddress']['state'] }); shipaddrSubrecord.setValue({ fieldId: 'zip', value: request['shippingaddress']['zip'] }); if (typeof request['shippingaddress']['custrecord_pl_store'] !== 'undefined') { shipaddrSubrecord.setValue({ fieldId: 'custrecord_pl_store', value: request['shippingaddress']['custrecord_pl_store'] }); } if (typeof request['shippingaddress']['custrecord_sh_shipping_acct'] !== 'undefined') { shipaddrSubrecord.setValue({ fieldId: 'custrecord_sh_shipping_acct', value: request['shippingaddress']['custrecord_sh_shipping_acct'] }); } } else { theRecord.setValue( { fieldId: 'shipaddresslist', value: request['shiptoid'] } ); } }
b
country is more important than you are treating it here. custom address fields are associated with the custom address form. Custom address form is associated with the country
that country field is essentially mandatory and matched with the custom address fields
a
Understood. Thank you, I'll update.
I knew it was important, this particular partner doesn't include it in their ship-tos. I will update to be US when none is present (during payload creation)
Thanks!
b
you would also want to make sure that US is setup on the custom address form and that the custom address fields are setup to show on that form
a
Yes, US is used in other partners for this client. I do now see 1 of the custom fields and have reached out to see if they can confirm the form is set to show the 2nd. Thank you!