top of page

Launch a Workflow from a button on a form



Making a system as user friendly as possible is always harder than we give it credit for. Sometimes end users need to trigger manual workflows in your solution. The standard Dynamics 365 way of doing this is to select off the ribbon the workflows option which then presents you with one of the least intuitive interfaces for selecting a workflow, I mean what is "Add" all about.

Problem

I would like to give an end user a friendly button they can click which appears when needed

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/_forms/form.js

  3. Function Name = Mscrm.FormAction.launchOnDemandWorkflowForm

  4. Add a CRM Parameter

  5. CRM Parameter = PrimaryEntityTypeCode

  6. String Parameter = “GUID of the Workflow” (You can get this by editing your workflow, it’s in the URL)

  7. Display Rules / Enable Rules = These are optional and control when it gets displayed, e.g. only appear when a certain field is complete. Very useful, I’ll write another aide-memoire on these.

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

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