top of page

Launch a Workflow from a button on a grid



Previously I discussed to launch a workflow from a form, today i'll extend this to make it work from a grid.

Problem

I would like to give an end user a friendly button they can click which appears when needed on either the sub grid or main grid

Solution

Step 1 – You will need Ribbon Workbench, I prefer the one that sits in the XRM Toolbox, as it seems to run faster

Step 2 – Create a new “Command”


Step 3 – For the new Command we need to make it call our workflow

  1. Give it an Action of “Custom Javascript Action

  2. Library = /_static/_common/scripts/RibbonActions.js

  3. Function Name = Mscrm.GridRibbonActions.launchOnDemandWorkflow

  4. Add a CRM Parameter, CRM Parameter = SelectedControl

  5. Add a CRM Parameter, CRM Parameter = SelectedControlSelectedItemReferences

  6. Add a CRM Parameter, CRM Parameter = SelectedEntityTypeCode

  7. String Parameter = “GUID of the Workflow” (You can get this by editing your workflow, it’s in the URL) or using the API as per the previous article "Dynamics 365 Quick way to get a record's guid, and what the source data looks like",


Step 4 – Create a new button (Top option on the left)

  1. Drag the button onto the ribbon were you want it to appear, I've included this one on the form

  2. Select the command you just created from the drop down

  3. Pick images for it, you can always create your own


Important

  1. Leave the CommandCore value blank, this will autopopulate with the command name on publish

  2. If you are having issues with display / enable rules not seems to take affect wipe the CommandCore value out and republish

  3. The order of the parameters is important in the Command

Comentarios


Featured Posts
Recent Posts
Archive
Search By Tags
No tags yet.
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page