Please wait, loading...

 

Xrm.Navigation.navigateTo : Open Html Web-resource or new – existing record form as a Dialog in Dynamics 365 CRM OOB

June 10, 2020

1. Open an existing contact record within a dialog on change of primary contact
2. Open a new address record on change of primary contact within a dialog
3. Open an HTML web resource within a dialog on the Account form

Every now and then we might have come to a requirement where the customer says I want to edit 2nd entity on the same form he/she has opened or view it (not satisfied with quick view form), recently I found an OOB method but the only limitation is it’s supported in Only Unified UI.

It can perform 3 types of navigation: Entity List, Entity Record or HTML Resource and that is most commonly we use or requires right.

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/06/open-record-in-a-dialog-navigationto-dvmske.png?fit=1220%2C1492

Check1:Open an existing contact record within a dialog on change of primary contact

I have come up with this requirement much time, where the user wants an option to check and change the values of primary contact manually when primary contact is changed and they don’t want to navigate to different form either.

here we will use below JS snippet available on Microsoft Doc (Click here) on change of Primary contact

var pageInput = {
  pageType: "entityrecord",
    entityName: "contact",
    entityId: "4da0e5b9-88df-e311-b8e5-6c3be5a8b200" //replace with actual ID
};
var navigationOptions = {
    target: 2,
    height: {value: 80, unit:"%"},
    width: {value: 70, unit:"%"},
    position: 1
};
function OpenPrimaryContact()
{
debugger;
Xrm.Navigation.navigateTo(pageInput,navigationOptions);
}

On Change of Primary contact, a Dialog appears inside account record

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/06/img_5ee09ceeb0c80.png?fit=1911%2C950

Check2:Open a new address record on change of primary contact within a dialog

The user wants an option to add a new address record each Time primary contact is changed .

here we will use below JS snippet available on Microsoft Doc (Click here) on change of Primary contact

var pageInput = {
  pageType: "entityrecord",
    entityName: "customeraddress"   
};
var navigationOptions = {
    target: 2,
    height: {value: 80, unit:"%"},
    width: {value: 70, unit:"%"},
    position: 1
};
function OnChangePrimaryContact()
{
debugger;
Xrm.Navigation.navigateTo(pageInput,navigationOptions);
}

On Change of Primary contact, a Dialog appears inside account record to create “Customeraddress”

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/06/img_5ee0ac63ba367.png?fit=1920%2C979

Check3:Open an HTML web resource within a dialog on the Account form

here we will use below JS snippet available on Microsoft Doc (Click here) on change of Primary contact

var pageInput = {
  pageType: "webresource",
    entityName: "dvm_htmlwebresource.html"   
};
var navigationOptions = {
    target: 2,
    height: {value: 80, unit:"%"},
    width: {value: 70, unit:"%"},
    position: 1
};
function OnChangePrimaryContact()
{
debugger;
Xrm.Navigation.navigateTo(pageInput,navigationOptions);
}

On Change of Primary contact, a Dialog appears inside account record with HTML resource

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/06/img_5ee0c0fb4e32e.png?fit=1920%2C979

CLICK HERECheck more Checkout the OOB method of XRM.Navigation

openAlertDialog
openConfirmDialog
openErrorDialog
openFile
openForm
openUrl
openWebResourc

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/Microsoftdynamics365.png?fit=640%2C651
Microsoft Dynamics Community Profile

Learn more