RE: Client API, retrieve records
Here is my updated code and it works for some extent. I receive the error saying "the value is not an array".
Below is the updated code:
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=_iis_primarycontactid_value").then(
function success(data){
var cnt_id= data._iis_primarycontactid_value;
Xrm.WebApi.retrieveRecord("contact",cnt_id,"?$select=lastname,fullname,telephone2,mobilephone").then(
function send(success){
var full_name= success.fullname;
var home_phone= success.telephone2;
var mobile_phone= success.mobilephone;
formContext.getAttribute("iis_customername").setValue(full_name);
formContext.getAttribute("iis_homephone").setValue(home_phone);
formContext.getAttribute("iis_mobilephone").setValue(mobile_phone);
});
});
}