How to get the app name inside plugins in Dynamics 365/ Model driven apps.

The importance of age old plugins never ceases to exist. Since the advent of Microsoft CRM plugins has been there and I presume it will be there in the years to come.

Since the introduction of model driven apps, it has always been a ask to execute app specific logic inside plugins. The necessity of app specific plugins has been there for quite sometime. But unfortunately there was no way to deduce the app from which the operation was performed and the plugin executed.

Let’s take an example here. I have a table named Inspection which is there in two model driven apps. Check for the below screenshots.

Get Model driven app name inside plugins.
Get Model driven app name inside plugins.

I have a plugin registered on create of Inspection table. But I want to perform different logic depending on whether an inspection is created from Permit 1 app or Permit 2 app.

Although I could not find an official documentation for this, in the InputParameters property bag of plugin context, there is a property – x-ms-app-name

Get Model driven app name inside plugins.

As you can see from the above screenshot, the property mentioned has the appname – cr293_App2

Once you have the app name, you can execute app specific logic in the plugins. I have tried with majority of the messages and all of them has this property in the InputParameters collections.

As I said earlier, this documentation I could not find but if case you are in dire needs, this may turn out to be a life save.

Hope this helped! You will also like the below posts.

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

1 thought on “How to get the app name inside plugins in Dynamics 365/ Model driven apps.”

  1. Very useful Debajit thanks for sharing. Usually we used to create /set a custom field to make sure plugins don’t get fired across different applications / or set of users.. This will be a better way of achieving the same. Hope we see it documented soon.

Comments are closed.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading