Can't get the following script to work in either of our production accounts (2 different companies). However the script works just fine in my testing account which is setup the exact same way.
Client script applied to the estimate form (Field Changed Function)
First isssue:
The alert to display the customer record phone number does not appear, I think is is because CustRecord.getFieldValue
This is the error according to firefox3
Error: [Exception... "'[object Object]' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]
Second Issue:
Because of the first error, the subtabs are disabled (can't select them)
function getCustomerPhone(){ var CustomerID = nlapiGetFieldValue('entity'); alert(CustomerID); // alert to display the Customer record ID var CustRecord = nlapiLoadRecord('customer', CustomerID); //Loads record var Phone = CustRecord.getFieldValue('phone'); alert(Phone); // Should display either null or the customer record phone number } When I use the following the error message is undefined try { var CustomerID = nlapiGetFieldValue('entity'); alert(CustomerID); var CustRecord = nlapiLoadRecord('customer', CustomerID); var Phone = CustRecord.getFieldValue('phone'); alert(Phone); } catch(err) { alert(err.message); }