I am currently writing a script on the Sales Order to pull fetch a custom field attached to the selected shipping address. I am able to pull all of the address fields (city,zip, etc) but I am unable to figure out how to access any of the attached custom fields to the address.
Example 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 works
var zip = customer.getLineItemValue('addressbook', 'zip', i);
console.log('zip:' + zip);
//this does not work
var custrecord19 = customer.getLineItemValue('addressbook', 'custrecord19', i);
console.log('custrecord19:' + custrecord19);
}
}
I am sure I am missing something simple. Any help greatly appreciated!
Zip