Search

CRM4:Launch on demand workflow

Sometimes we need to launch a workflow on a button click rather then selecting from the workflow menu. This is how to to do it in CRM 4.0. CRM has two hidden function to launch a workflow, but they have implementation for Form & Grid.

To call a workflow from a form button, we need to create a button in the form and call the javascript function launchOnDemandWorkflowForm

//when called from en***y form
launchOnDemandWorkflow(“”,ObjectTypeCode,Workflow ID)

//Example


launchOnDemandWorkflowForm("",10032,"{154599DD-B20B-4F72-8771-CA93C660C820


 


To call a workflow from a grid button, we need to create a button in the grid and call the javascript function launchOnDemandWorkflow

//when called from grid
launchOnDemandWorkflow('crmGrid',ObjectTypeCode,Wo rkflow ID)

//Example


launchOnDemandWorkflow(““,10032,"{154599DD-B20B-4F72-8771-CA93C660C820}");



We can also use the direct workflow dialog.Like


"/_grid/cmds/dlg_runworkflow.aspx?iObjType=1090&iTotal=1&wfId=% 7B15B4EB9B-5C68-46DE-8BFC-A0F4B0A29523%7d"


but you need to use CrmUrlEncode function to pass the values