
function relatedcontacts(executionContext)
{
var formContext = executionContext.getFormContext();
if (formContext.getAttribute("parentaccountid").getValue() != null)
{
var prntacc = formContext.getAttribute("parentaccountid").getValue()[0].keyValues;
primarycont = prntacc.primarycontactid;
formContext.getAttribute("primarycontactid").setValue(primarycont);
}
else
{
return false;
}
}
Also what are the possible ways to retrieve related entity value using Javascript ?
Hi partner,
If you want to set a value to lookup field, please use the following format.
BTW, if you want to get related entity value, you could use web api to do this.
1.Get the related record id from lookup field.
2.Get the related record data from web api. For example I want to get the full name of contact by contactid.
Best Regards,
Leo