Create Custom Workflow Activities

Aim: Create Custom Workflow Activity

Purpose: The Main purpose of Creating custom work flow is to update or change the value of field item before save activity.

Example: There are 2 entity’s one is Contact and another one is Account.When user giving inputs in contact form  and try to enter the year for Date of Birth on that time it requires the activity to store or the age instead of year. on this scenario some back ground process need to be performed.So we go for Custom Workflow activity

Please find below objective

Objective:
Create a Custom Workflow Activity, that creates a (follow up-)Task after an Account was created. (This is just an example. You can use default workflow functionality to reach this target.)

Prerequisite: Install developer tool kit for 365 from below link Visual studio Developer Tool Kit

Step by Step Process

Step1: Open the Visual Studio 2016/Ultimate 2012 from the Programs

Step 2: From List of Template Select

VsTemplets

Step 3: Create Package by selecting Dynamic 36 package

Step 4: Give Appropriate name for the Package

Step 5: If we get error that tools are not configured properly then provide path as below image

Toolpath

Step 6: After success full configuration then try to create Package as per Step2

Step 7: CrmInstanceonlinelinkwithdevtool provide Crminstance,userid and password as per below image

CrmInstanceonlinelinkwithdevtool

Step 8: Click Yes to continue

Step 9: Add “Dynamic CRM WorkFlow Activity” from the Template as per below image

Adding New Project to CrmPackage

Step 10: After Successful creation you find the Solution tree as below image

SolutionTree

Step 11: You will find the class of “WindowsActivity” base file along with CRM explorer

CrmExplorer

Step 12: Select the “Entity” on which you are working from the CRM explorer

Step 13: You will get pop up window as below

CustomWorkflowActivity

Step 14: Click ok it will create Workflow activity class

Step 15: Provide Input parameters as per below

WFinputParametrs

Step 16 : In Override method ExecuteCrmWorkFlowActivity

ExecuteWorkFlowActivity

Step 17: Now another keen role is to Sign the Assembly

Right Click the Project -> Properties -> Signing -> Sign the assembly -> New -> Enter Key file name "testkey" -> no password (for testing purposes).

Signing
10. Compile and deploy the assembly
Rebuild your solution and deploy the assembly to the CRM System. This can be done by the PluginRegistrationTool of microsoft. You can find this as part of the current CRM-SDK. You have to compile it by your own. Choose the following settings.

Deployment
11. Create a Workflow with the new step
Create a default Workflow in CRM. Choose the following settings.
Workflow basic configuration
Add the new step
Push the SetProperties-Button of the step and select a default name for the Input Parameter (TaskSubject). Because the Owner of the new task should see which account was created, we add the name of the account as input parameter.

Set input parameter
Now save and don't forget to activate  the Workflow.
12. Testing
Create a new Account in CRM.
Create Account
Processing the workflow can take some seconds. Open the Activity List of the account and select Filter on "All". You should see our created task. The subject contains some static text and the name of the created account.
Activity View
r Key file name "testkey" -> no password (for testing purposes).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s