Currently in the process of creating a Sales Order script to extract a custom field linked to the chosen shipping address. While I have successfully retrieved all address fields (such as city and zip), I am facing challenges when attempting to access any custom fields associated with the address.
Here's an example of the script:
var custid = document.getElementById("hddn_entity_fs").value;
var shiptoid = document.getElementById("hddn_shipaddresslist2").value;
var customer = nlapiLoadRecord("customer", custid);
var itemCount = customer.getLineItemCount('addressbook');
for (var i = 1; i < itemCount; i++) {
if (customer.getLineItemValue('addressbook', 'id', i) == shiptoid) {
//this section functions
var zip = customer.getLineItemValue('addressbook', 'zip', i);
console.log('zip:' + zip);
//the following part encounters issues
var custrecord19 = customer.getLineItemValue('addressbook', 'custrecord19', i);
console.log('custrecord19:' + custrecord19);
}
}
I know there must be a simple solution that I'm overlooking. Any insights or assistance you can provide would be greatly valued!
Sending gratitude your way,