Developing Custom Workflow Activities in CRM 4.0
We can create our own custom workflow activities and register it so that they can appear inside workflow editor in CRM.
For creating custom workflow activity we need to first select Workflow Activity Library project template inside Visual Studio with framework version 3.0.
Class within the activity library should derive from Activity class or could derive from SequenceActivity class.
Let’s create a simple custom workflow class
For this add a class inside your Workflow Activity Library project.
Add reference to Microsoft.Crm.Sdk and Microsoft.Crm.SdkTypeProxy dlls.
}
CrmWorkflowActivity Attribute – To allow our activity to be visible inside the workflow editor. First parameter is the name of the workflow activity and second parameter is the group name, which could be used for grouping similar kind of workflow activities.
We can create custom activity by inheriting SequenceActivity class, which would be a composite activity wherein we can add other activity available with windows workflow foundation like
IfElseActivity,IfElseBranchActivity,PolicyActivity,DelayActivity etc.
For this right click on your project and add a new Activity in your project.
Open it in design mode. We can see the option of (Drop Activities Here)
Therein we can drop the built in activities found in windows workflow foundation for building our custom logic. Here we need not override the Execute method like we did in earlier case. The sequence activity will execute the activities that we would have dragged and dropped for writing our logic.
}
While building our workflow we could also define input and output parameter that will appear inside Set Properties dialog box while defining Step and Dyanmic Value editor inside Form Assistant respectively.
To define input and output parameters we need to make use of dependency property and CrmInput and CrmOutput Attribute.
For picklist
Using CrmService and MetadataService within custom workflow activity through workflow context
We can register our own custom services with workflow runtime. The built in services provided by Windows workflow foundation are following
PersistenceService, QueuingService, SchedulerService, TransactionService, TrackingService etc.
Similary MS CRM has used it to register ContextService with the runtime. It provides the current context information for the workflow instance which is executing at that time.
}
For registering the custom activity we need to use Plugin registration tool.
Open Plugin Registration Tool
Select Register New Assembly
Select you assmebly ( It should be signed assembly and no need to specify anything else within the plugin registration tool).
Click on Register Selected Plugin
Restart Crm Asynchronous Service
Bye..
Posted in Microsoft Dynamics CRM Tagged: CRM
This was originally posted here.

Like
Report
*This post is locked for comments