What are Custom Workflow Activities?
- Custom Workflow Activities can be added to an existing workflow to provide additional functionality in Workflows in CRM.
- Workflow Assemblies are included in steps of a workflow designer where input parameters can be provided to the same to carry out its designated functionality.
- Required Assemblies are Xrm.Sdk and Microsoft.Xrm.Sdk.Workflow
- Custom Workflow Activities can be written by deriving CodeActivity class in your workflow assembly.
- Custom Workflow Activities have Input and Output parameters that take and give out data to the workflows.
- protected override void Execute(CodeActivityContext context){ //Activity code} needs to be initialized to add functionality to a Workflow Assembly.
Registering a Custom Workflow Assembly.
- Custom Workflow Activities are registered in Plugin Registration Tool.
- They are not registered on a particular entity or on any message, like a Plugin.
- Registered Custom Workflow Assemblies then appear in the workflow step designer.
- We can specify the Name of the workflow and the WorkflowActivityGroupName in the Plugin Registration Tool as shown below.
Input and Output Parameters of a Workflow Assembly.
- Here is an example of how we can declare an input parameter to a custom workflow assembly as follows:
- A default value can be provided along with declaring the Argument.
- Same way, we can add Output parameters to the custom workflow assembly as below.
- Or even declaring the Argument as both, input and output argument which is as follows:
Attributes and Microsoft Dynamics CRM Types.
- Bool
- DateTime
- Decimal
- Double
- EntityReference
- Int
- Money
- OptionSetValue
- String
So, that was a short and quick introduction about Custom Workflow Assembly! Hope this is helpful. 🙂