Hi All,
I am using the following code to retrieve field value and retrieving another record data and writing to the form. Can anyone help me with troubleshooting please.
function callsetvalue(executionContext){
debugger;
var formContext = executionContext.getFormContext();
var record_id = formContext.getAttribute("regardingobjectid").getValue()[0].id;
Xrm.WebApi.retrieveRecord("iis_project",record_id, "?$select=fullname,iis_primarycontactid_value").then(
function success(result){
var c_id = "result.iis_primarycontactid_value:";
},);
Xrm.WebApi.retrieveRecord("contact",c_id, "?$select=fullname,telephone2,mobilephone").then(
function success(result){
formContext.getAttribute("iis_customername").setValue(result.fullname);
formContext.getAttribute("iis_homephone").setValue(result.telephone2);
formContext.getAttribute("iis_mobilephone").setValue(result.mobilephone);},);
}