{Quick tip} Show a modal record in specific form in Dynamics 365 model driven app using Xrm.Navigate.navigateTo

With PowerApps release wave 1 2020, Microsoft have released quite a few features under the hood. While some  have hogged the limelight, others continue to evolve in the platform like hidden gems. And one of them is the enhancement in much loved Xrm.Navigate.navigateTo API.

Now with this API you can open an entity record modal and that too with the choice of form you want.

While this blog teaches you on how to do all this using sample code, this kind of feature is actually going to save you loads of time. Imagine you wanted to show specific record form as modal while working on something else. And previously you would require to develop a HTML web resource and map the values back to D365 record. Now you can just use few lines of code to do the same.

Below the sample code piece to open a contact record. Please note as of the current version, only form of type Edit is supported.

Xrm.Navigation.navigateTo({
pageType: “entityrecord”,
entityName: “<put your entity logical name here>”,
formType: 2, // you can only open a form in edit mode as of now. Other form types are not supported.
entityId: <put your record id here>
}, {
target: 2,
position: 1,
width: 700,

       height:600
});

And below is what you see.

image

Awesome isn’t it? Now one problem here is the record will open on the default form. What if you want to open the record in a form of your choice. Well here you go.

Xrm.Navigation.navigateTo({
pageType: “entityrecord”,
entityName: “<put your entity logical name here>”,
formType: 2, // you can only open a form in edit mode as of now. Other form types are not supported.

    formId: “<put your formid here>>”
entityId: <put your record id here>
}, {
target: 2,
position: 1,
width: 700,

       height:600
});

I wrote some code to open it in Information form as you can see below, it did just that

image

Hope this helps!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Author: Debajit

I am a Dynamics CRM Most Valuable Professional (MVP) with 12 years of experience in Microsoft .NET Technologies and 9 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

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