Hello All,
I am working with V9.1 where I observed that Xrm.Navigation.openForm() is not working for an existing record instead I used the deprecated way Xrm.Utility.openEntityForm() then it works as expected.
It is opening the record but all the fields are blank, so I tried the deprecated way then it works.
var entityFormOptions = {}; entityFormOptions["openInNewWindow"] = true; entityFormOptions["entityName"] = myEntity; entityFormOptions["entityId "] = myEntityGuid; Xrm.Navigation.openForm(entityFormOptions);
Any suggestions?
Thanks,
Indrasheker
*This post is locked for comments
Thanks mate didn't observe.
Hi Rawish,
I have tried using successCallBack too but no luck. Also please see the below attached the response from sucessCallBack(id is undefined).
Thanks,
Indrasheker
Hi,
You have space in your entityId parameter. So CRM must be opening a new form instead of an existing form. Try this-
==========
var entityFormOptions = {};
entityFormOptions["openInNewWindow"] = true;
entityFormOptions["entityName"] = myEntity;
entityFormOptions["entityId"] = myEntityGuid;
// Open the form.
Xrm.Navigation.openForm(entityFormOptions).then(
function (success) {
console.log(success);
},
function (error) {
console.log(error);
});
===========
Hope this helps.
Hi Indra,
Do you have your return functions at the end of calling .openForm() function.
function OpenNewEntityForm() {
var entityFormOptions = {};
entityFormOptions["entityName"] = "contact";
entityFormOptions["openInNewWindow"] = true;
// Set default values for the Contact form
var formParameters = {};
formParameters["firstname"] = "SEREN";
formParameters["lastname"] = "SERIFOGLU";
formParameters["fullname"] = "SEREN SERIFOGLU";
formParameters["emailaddress1"] = "seren.serifoglu@live.com";
// Open the form.
Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
function (success) {
console.log(success);
},
function (error) {
console.log(error);
});
}
This totally works on with Version 1710 (9.1.0.1658) online / v9.1
You can try with above sample code. If you need further information about parameters;
Hope it helps.
Cheers, Seren.
Hi Indrashekar,
the code looks fine and should work as suggested here : docs.microsoft.com/.../openform
the only difference is you are not using a successCallBack function but i believe is option and wont really create issues.
I would recommend you try to debug the script and see if you have anything in the console?
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
Victor Onyebuchi
6