Fire plugin from Ribbon – Header in CRM 2015 by calling Action

Posted on Posted in MS CRM 2013, MS CRM 2015, MS Dynamics CRM

I recently had a requirement where client wanted to fire a Plugin on demand in CRM 2015 i.e. from a button in header, something like next to Assign a new button Publish

Here is a little background about the requirements

For inventory control solution user wanted to adjust quantity of multiple products in a single go and to achieve this two new entities (StockCount, StockCountItem) were created. User could go in and create a new Stock Count record and then add multiple Stock Count Items and once happy could fire this plugin to adjust stock amount of all linked Stock Count Items.

First thing I did was to added a new plugin like any normal plugin and gave it a name PostStockCount

Second part was to add a button to header of Stock Count entity

As you can see above a new button Publish

This button was added using Ribbon Workbench

Then I had create a new Action to call this Plugin. Below is a screen shot of all settings for this process

After creating action I went into plugin registration tool and update plugin with following values – main step is to call Action name what we created above

After publishing all changes every thing worked perfect and plugin was being fired by pressing header button