There are a lot of quick ways of doing things in Dynamics CRM but developers struggle with finding how. Today I am going to explain how to call a workflow on a custom ribbon button.

Let’s say you have a situation, where you want to perform some operation on custom ribbon button on “click event”. Let us take an example. I have a button on OPPORTUNITY form called ‘ConfirmRequest’. On the click event of this button I have to generate an ORDER and also want to send an email. The best way to achieve this is by creating a workflow. But the issue is, how to call workflow on the button click.

There are many solutions posted on the web, that involve using learnacademy.org ruby javascript coding, web resources etc. however, there is a much easier way that requires no coding.

For this we use Ribbon Workbench. Contact us to find out the right plugin to download.

Here are the steps to follow:

  • Create a workflow, for example – I created a workflow called Generate Order from Opportunity.
  • Extract the GUID of this workflow with the help of advanced find. Here is how you do it:
    • Open advanced find window
    • Look for processes and search for your workflow name
    • Export to Excel and extract the GUID of the proceed from the column A called (Do Not Modify) Process.
  • Load the new solution into the Ribbon Workbench with OPPORTUNITY entity.
  • Expand the commands, “Solution Elements” tab.
  • Right-click on the Command of the custom button that you want to use. Example ‘CCSDP.opportunity.GenerateOrder.Command’ and select ‘Edit Actions’.
  • Add a JavaScript Command and set the following properties:
    Function NameMscrm.FormAction.launchOnDemandWorkflowForm
    Parameters1: Type = Crm Parameter,
    Value = PrimaryEntityTypeCode
    2: Type = String,
    Value = Workflow ID which is extracted from advance find

  • Click on OK. And publish it. The workflow will start getting called from the click of the custom button.

Congratulations!!! Now you know how to call workflow from a Custom Ribbon button on Dynamics CRM.