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
});
}
}
}
thank you for the code and reference. This fixed the issue.
Xrm.WebApi.retrieveRecord("new_accountrole", roleId, "$select=_new_accountid_value")
.then(function(result) {
var accountid = result["_new_accountid_value"];
On the code above in Xrm.WebApi.retrieveRecord method call, the options parameter (3rd one) should start with "?"
Correct code: Xrm.WebApi.retrieveRecord("new_accountrole", roleId, "?$select=_new_accountid_value")
I did try and it shows error in files of CRM, not any custom page or script
Difficult to see where you are having the JavaScript issue, you may want to try and debug it in F12, and see if you can isolate?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156