this code is working in web client but not in unified interface, how can fix it in model driven app (Unified interface) ?
var formParameters = {};
formParameters['partyid'] = partid;
formParameters['partyname'] = partname;
formParameters['partytype'] = pratytypeCode;
var entityFormOptions = {};
entityFormOptions.entityName = "phonecall";
entityFormOptions.openInNewWindow = true;
parent.Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
function (success) {
},
function (error) {
console.log(error);
});
Hello Johao Larios ,
Can you please mention link here where it is answered.?
Thanks Andrew Butenko,
Your post is very helpful.
regards
Nadeem Hassan
Here is my post - butenko.pro/.../
Hello Nadeem
You can try to use this code, it will work.
It is needed to query for the fullname since it isn't in the form.
function test() { var fullname = ""; var req = new XMLHttpRequest(); req.open("GET", Xrm.Page.context.getClientUrl() "/api/data/v9.1/contacts(" Xrm.Page.data.entity.getId().replace("{", "").replace("}","") ")?$select=fullname", false); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("Prefer", "odata.include-annotations=\"*\""); req.onreadystatechange = function() { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 200) { var result = JSON.parse(this.response); fullname = result["fullname"]; } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send(); var partyid = Xrm.Page.data.entity.getId(); var partyname = fullname; var partytypecode = "2"; var formParameters = {}; var value = new Array(); value[0] = new Object(); value[0].id = partyid; value[0].name = partyname; value[0].entityType = "contact"; formParameters["to"] = value; var entityFormOptions = {}; entityFormOptions["entityName"] = "phonecall"; entityFormOptions["openInNewWindow"] = true; Xrm.Navigation.openForm(entityFormOptions, formParameters).then( function (success) { }, function (error) { console.log(error); }); }
Nadeem,
I found an answer and it will be posted on my blog today/tomorrow. Subscribe to it or to my twitter to see the notification about new posts.
Hello Nadeem,
This was answered in another forum, please verify.
Regards.
Hello Nadeem,
If you are not getting errors, please create a ticket with MSFT. I don't get why you are using the word "parent". Before opening the ticket I would suggest you please try as is mentioned on this link:
docs.microsoft.com/.../openform
Xrm.Navigation.openForm(entityFormOptions,formParameters).then(successCallback,errorCallback);
I have use it on UCI without issues. But if you use this and you are still getting problems, please create a ticket.
Nadeem,
Please, don't create duplicated threads.
Thanks Henry Jammes,
Yes there in no any error in console.
thanks for support link.
Thanks Nadeem.
Even in the console (F12)?
If you can't share more details, I suggest you open a Support Request here to have someone help you troubleshoot this: https://admin.powerplatform.microsoft.com/support
Henry
André Arnaud de Cal...
292,162
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156