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.
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
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”
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