Custom Workflow Activities for Microsoft Dynamics CRM Online

By | January 28, 2013
With Polaris it is now possible to register Custom workflow assembly for CRM Online as well. In continuation of our earlier series here where we provided the steps to use the Developer Kit, we have now added the steps to create Workflow activities for CRM Online using the new version of the developer toolkit that is available in the latest SDK and can be downloaded from http://www.microsoft.com/en-in/download/details.aspx?id=24004


To register the workflow in CRM Online follow below steps:

Open the Visual Studio; go to File → New Project → Dynamics CRM → Dynamics CRM 2011 Package and Click Ok. 




After that Connect to Dynamics CRM Server


 


On click of Ok button the package will open then add a new project to this package. Right click on solution → Add → New Project.





The below window will be pop up to select the project type. Select Dynamics CRM 2011 Workflow Library, give the project name and click Ok.



Once the project is loaded add a Class file for the workflow. To do this right click on project click “Add New Item”.


 


Select the Class type as Workflow Activity Class. This will generate the Class with the Execute method



You can implement your logic indicated by // TODO: as given in the below screen shot.


Once the logic has been implemented double click on “RegisterFile.crmregister” see below screen.



This will open the below file, here change the IsolationMode to “Sandbox”.


Build the solution and deploy. After that go to CRM and create a Workflow as per your requirement and add the Custom workflow assembly to this workflow as shown in below screen shot.


After adding the assembly activate the workflow. This will activate your workflow and you can check your workflow is running successfully.

Possible Errors during deploying the package:

1.      You may get an error “Plug-in assembly does not contain the required types or assembly content cannot be updated” this is because you may have changed the Class name or assembly name or Default Namespace and this class name or assembly or Default Namespace name has not been updated in the “RegisterFile.crmregister” file. You must update the changes in the “RegisterFile.crmregister” file.

2.      You may also get an error “Error registering plugins and/or workflows. Description name must be specified Parameter name: description”. This is because when we add a new Workflw Activity Class file in the project it will ask for the below assembly information.

 

All the above information are required, if you miss any of the above information you may get an error “Error registering plugins and/or workflows. [Parameter Name] name must be specified Parameter name: [Parameter Name]”