Now Open CRM record in dialog using navigateTo Client API

By | May 5, 2020

Introduction

With 2020 Release Wave 1 Update for Dynamics 365, we can open main form of CRM record in dialog using navigateTo Client API. Earlier, we used Xrm.Navigation.openForm method to open CRM record and this method opened the CRM record in new window or same window of browser.

Using navigateTo Client API, we can open the CRM record in dialog from our custom web resource or any CRM form, without leaving our current form or web resource.

Below, we have provided information about how to open the CRM record in dialog.

Open new CRM record

Here we have opened new CRM record of contact entity.

var pageProperty = {

pageType: “entityrecord”,

entityName: “contact”,

formType: 2,

};

var navigationProperty = {

target: 2,

width: {value: 80, unit:”%”},

position: 1

};

Xrm.Navigation.navigateTo(pageProperty, navigationProperty);

navigateTo Client API

Open existing CRM record

Here we have opened existing CRM record of contact entity.

var pageProperty = {

pageType: “entityrecord”,

entityName: “contact”,

formType: 2,

entityId: “979dfe31-0686-ea11-a811-000d3a579c9c”//guid of record

};

var navigationProperty = {

target: 2,

width: { value: 80, unit: “%” },

position: 1

};

Xrm.Navigation.navigateTo(pageProperty, navigationProperty);

navigateTo Client API

Conclusion

With the help of navigateTo Client API, we can open main form of CRM record in dialog.

4 thoughts on “Now Open CRM record in dialog using navigateTo Client API

    1. Inogic Post author

      As of now, there is no parameter added in ‘navigateTo’ Client API to hide ribbon buttons in the dialog.

      If you want to open the CRM record without ribbon buttons then you can use Xrm.Navigation.openForm method. This has the parameters to hide/show ribbon buttons, as shown in the below screenshot:

      navigateTo

      Hope this helps.

      Thanks!

      Reply
  1. Umer

    Hi,

    Thanks for the post. just wondering which form event your code is being called for to open the dialog shown above?
    Also can we do the same on home page? E.g. We are on the list view of Accounts, currently when we create new Account by clicking the button on the ribbon, the form is opened in same window hence we loose the list view of Accounts.
    Thanks

    Reply
    1. Inogic Post author

      Yes, you can do this on the home page also. You need to add ‘navigateTo’ Client API code on the ribbon button. In our case, we called ‘navigateTo’ Client API code on the onChange event of the field.

      Thanks!

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *