Hi experts,
I have changed the system settings to use the new Unified Interface only option to 'yes'. I created a model-driven app and added existing account and appointment entities from the default solution. While testing these entities in the new UI, I get this error
Downloaded log file shows issue with below JavaScript function. Did anyone faced this issue and found solution?
I have a web resource in appointment entity and I call a function in on-load.
function setAccountName(execContext){
var formContext = execContext.getFormContext();
if(formContext != null){
var roleId = formContext.getAttribute("regardingobjectid").getValue();
var accountId = formContext.getAttribute("new_accountid").getValue();
if(roleId != null && accountId == null){
roleId = roleId[0].id;
//var formType = formContext.ui.getFormType();
Xrm.WebApi.retrieveRecord("new_accountrole", roleId, "$select=_new_accountid_value")
.then(function(result) {
var accountid = result["_new_accountid_value"];
var accountname = result["_new_accountid_value@OData.Community.Display.V1.FormattedValue"];
var enttype = result["_new_accountid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
//alert(accountname);
if(accountid != null){
formContext.getAttribute("new_accountid").setValue([{ id: accountid, name: accountname, entityType: enttype}]);
}
})
.fail(function(error) {
var message = error.message;
//Add handling of error that occurred
});
}
}
}