function onload(executionContext){
var formContext = executionContext.getFormContext();
//Gets the value of the Account Lookup field.
var account = formContext.getAttribute("parentcustomerid");
//If the Account Lookup field is empty, exit and clear the Text Area field.
if(!account){
formContext.getAttribute("cr8a7_textarea").setValue(null)
return;
}
//Get the ID of the account record in the account lookup field
var accountId = account[0].id;
//Retrieves the value of this account record.
Xrm.WebApi.retrieveRecord("account", accountId, "?$select=name,fax").then(
function success(result) {
// Populate the Text Area field with the fax for this account record.
formContext.getAttribute("cr8a7_textarea").setValue("Retrieved values: Name: " + result.name + ", Fax: " + result.fax)
},
function (error) {
console.log(error.message);
// handle error conditions
}
);
}