This article will cover how we can create a custom workflow action for Workflows with Sitecore.
OOTB Submit Actions
Sitecore offers a few OOTB Submit Actions which can be used as per your requirements.
- Auto Submit Action
This action can be utilized to automatically submit an item if it is saved by a user from a certain role.
It accepts the Type (which will remain the same), Next State and the Role Name.
Template Path: /sitecore/templates/System/Workflow/Auto Submit Action
- Validation Action
It can be used to refuse a change in state if the item has validation errors.
You can mention the maximum allowed result - Warning, Error etc. and the messages to be shown in case of errors.
Template Path: /sitecore/templates/System/Workflow/Validation Action
- Auto Publish
Auto Publish, as the name suggests can be used to trigger a publish on the item if it moves to a certain final state.
It accepts parameters such as deep (To publish with subitems) and smart (For a smart publish).
Template Path: /sitecore/templates/System/Workflow/Action
Type: Sitecore.Workflows.Simple.PublishAction, Sitecore.Kernel
Parameters: deep=1&smart=1 (Set to 0 if false, or exclude it).
- Email Action
It can be used to send an email to mentioned emails to inform a state change.
Template Path: /sitecore/templates/System/Workflow/Email action
Creating your own custom workflow action
There are 2 steps in creating your custom workflow action:
- Create a template with the fields that you need to be passed to the workflow action code. The Type field is a mandatory field.
- Create a class with a Process method accepting a parameter of type WorkflowPipelineArgs. The fully qualified name of this class will be populated in the Type field of the action item.
The class will look like below:
public class CustomWorkflowAction
public void Process(WorkflowPipelineArgs args)
Item dataItem = args.DataItem;
ProcessorItem processorItem = args.ProcessorItem;
Item actionItem = processorItem?.InnerItem;
string myValue = actionItem["My Field Name"];
catch (Exception ex)
Now, you can add the action item under the workflow command on which you need it to be triggered. Remember to add the value for the Type field as the fully qualified name of the class.