Shipping Addressee getValue in Sales order

Scenario

The Shipping adressee value is null when getting the field value of the ship addressee in a sales order.

var addressee = nlapiGetFieldValue('shipaddressee');
Solution

The recommended way of getting the ship addressee in the sales order is by accessing the subrecord of shipping address field.

nlapiViewSubrecord('shippingaddress')

The line above will return the address subrecord which is an nlobjSubrecord. We can use certain nlobjRecord methods to get values from an nlobjSubrecord. For this scenario, we should use the getFieldValue method.

var addressee = nlapiViewSubrecord('shippingaddress').getFieldValue('addressee');

Leave a comment

Your email address will not be published. Required fields are marked *