Calling Dynamics 365 Plugins Using JavaScript

Calling Dynamics 365 Plugins Using JavaScript

In this blog, we shall see how to call a Dynamics 365 Plugin using JavaScript. Calling a Microsoft Dynamics 365 Plugin directly using JavaScript is not possible but with the help of an Action you can easily call and execute a plugin. We can do so because plugins run on CRM messages framework i.e. – Create, Update, Won, Share etc. Using Actions we can create our own custom messages and can run plugin for that message. This comes handy when there is a need to call server-side code from Form or Field events.

Flow:

Calling-Dynamics-365-Plugins-flow

Scenario: Create custom button on an entity and call plugin on button click

Steps

1. Create Custom Button on Entity using Ribbon workbench.

2. Download the Prcess.js solution from link (https://processjs.codeplex.com/). And import in Microsoft Dynamics CRM organization.

3. Add Process.js library on form, this simple JavaScript library allows you to easily call workflows, dialogs, and actions in CRM from forms, views, web resources, or anywhere that supports JavaScript.

Calling-Dynamics-365-Plugins-process (2)

4. Create Action Settings > Process > New

Calling-Dynamics-365-Plugins-process

5. Save > Activate

6. Create JavaScript web resource to call this Action and call the JavaScript function on custom Button Click.

Calling-Dynamics-365-Plugins-Using-

7. Now Create simple Plugin and Register plugin on Action.

Create-simple-Plugin-action-

Disclaimer– “All data and information provided on this blog is for informational purposes only. Dynamics Square / MPG Business Information Systems Pvt. Ltd. makes no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this site and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use.”