I'm trying to populate a custom field in the address entry form with the value from a custom field in the customer entry form. I've been using an existing script to experiment with this. For some reason I can populate the native fields with information from the customer entry form but I am unable to do the same with a customer field. In this example I just used the companyName again to try and populate my custom address field with something, even though this is not the data I want to populate this field with.
fieldChanged_Company = function () {
//
// If the company changes, we need to update the address
//
lnSeq = nlapiFindLineItemValue('addressbook', 'defaultbilling', 'T');
if (lnSeq > 0) {
nlapiSelectLineItem('addressbook', lnSeq);
companyName = nlapiGetFieldValue('companyname');
nlapiSetCurrentLineItemValue('addressbook', 'addressee', companyName, true, true);
nlapiSetCurrentLineItemValue('addressbook', 'custom_addr_field', companyName, true, true);
console.log('companyName' + ', ' + companyName);
}
nlapiCommitLineItem('addressbook');
};