Create Record URL in Dynamics 365/ CRM to open in specific model driven app. You don’t need to use the appid

Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at info@xrmforyou.com


This is one of the most common requirement you will get. You are constructing a record URL and say you want to open it in Sales Hub. You can ask me what’s the big deal in this. After all you can specify the appid querystring parameter in the record URL. But there is a problem here.


The problem is the appid for sales hub will be different for different environments. Let’s take an example here.
Below is the appid of the sales hub application opened in one environment
image

And below the sales hub opened in another environment.
image

As you can see, the appid is different for both the environments. So it’s quite obvious that you can’t hardcode the URL when you are trying to construct the recordurl. Let’s say you are creating the recordurl in email to open in specific app. For example – In the below screenshot when the URL is formed, the URL will not include the appid. You can obviously call a custom workflow assembly to get the appid. But is that the only solution?


image
Well the answer is NO. There is indeed another way you can do the same without using the appid querystring parameter. In-fact not known to many, there is another querystring parameter called “appname”. You can just specify the appname parameter with the unique name of the app and it would open in the same app.
For example the unique name of Sales Hub app is – msdynce_saleshub. And even if the ID differ, the unique name is same across all environments.
So I just appended the appname querystring parameter with the record url as shown in the screenshot below.
image
And now when I click the link in the email, the record opens fine in the sales hub.
Hope this helps!
Debajit Dutta
(Business Solutions MVP)