D365 V9{Upgrade}: Client API Change for openEntityForm

Prior to D365 V9, we were using Xrm.Utility.openEntityForm() to open an existing record or to open a create form of an entity providing some additional parameters. However, in D365 V9 as it has been deprecated, we need to use Xrm.Navigation.openForm() to perform the same operation.

Here’s an example of the change in API along with it’s parameters.
D365 V8:


var windowOptions = {
openInNewWindow: true
};
Xrm.Utility.openEntityForm("entity_name", "record_id", null, windowOptions);

D365 V9:


var windowOptions = {
openInNewWindow: true,
entityName: "entity_name" ,
entityId: "record_id"
};
Xrm.Navigation.openForm(windowOptions);

While creating a new record, we can pass values to the attributes using an object which is optional. Please see below sample:


var windowOptions = {
openInNewWindow: true,
entityName: "entity_name"
};
var formParameters = {};
formParameters["attr_1"] = "value_1";
formParameters["attr_2"] = "value_2";
formParameters["attr_3"] = "value_3";

Xrm.Navigation.openForm(windowOptions, formParameters);

Hope it helps!!

Advertisements

2 thoughts on “D365 V9{Upgrade}: Client API Change for openEntityForm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.