Invoke Global Custom Actions in Dynamics 365

| Ijlal Munnawer

When we create a plugin or a workflow, we define a message on the many available standard actions (for e.g., Create, Update, Delete, etc.) on which the process will trigger and execute the payload. In custom actions, we can define a custom message for different business needs and requirements. These custom actions can be invoked from JavaScript and other processes such as other workflows or business process flows. So, by creating a custom message, we can register a plugin based on our created message. In this blog, I’ll demonstrate a JavaScript code to call a custom action, configure a custom action and create a plugin based on that custom action, so everything is covered thoroughly.

To start things off, I’ll create a custom action from a new process creation dialog and choose a blank process with the category “Action”. We are not creating an entity specific action, so we’ll select Entity as “None (Global)”.

Display Properties in CSS

We don’t need to add any arguments or steps. Save it and activate it like below:

Display Properties in CSS

Now, I will code a plugin to be triggered on our custom action. We’ll require CRM SDK packages to be installed first before writing our plugin.

Display Properties in CSS

Plugin to create a contact when our custom action will be invoked. Build the plugin to create a .dll file which will be used to register our assembly.

Display Properties in CSS

Now register the assembly.

Display Properties in CSS

Registering new step will allow us to define our custom message as shown below and Primary Entity will be none because it has a global scope.

Display Properties in CSS

Now let’s call our action using JavaScript. We will use a simple piece of JS code to invoke our custom action. We can call it on any specific condition that we want to achieve from our JS.

Display Properties in CSS

We can test our JS by running it from the browser window.

Display Properties in CSS

As we can see our new contact is created from plugin invoked from our JavaScript code. We now have a way to call our plugin any time.

Display Properties in CSS

Join us next time, as we continue our journey of learning canvas apps.Click here to learn more about Imperium's Power Apps Services. We hope this information was useful, and we look forward to sharing more insights into the Power Platform world.


M
Chief Architect, Founder, and CEO - a Microsoft recognized Power Platform solution architect.

About The Blog

Stay updated with what is happening in the Microsoft Business Applications world and initiatives Imperium is taking to ease digital transformation for customers.


More About Us

We provide guidance and strategic oversight to C-Suite and IT Directors for on-going implementations. Feel free to give us a call.

1 331 250 27 17
Send A Message

Ready to Start?

Get a personalized consultation for your project.

Book a Meeting