Monday, April 4, 2016

Custom workflow actions in Sitecore

Simple workflows (content approval with rejection for example) in Sitecore can be achieved out of the box, and there are also modules such as Dynamic Workflow for more complex solutions. However there are cases where there is need to create a custom action (perhaps for a more advanced emailer with HTML templates and other advanced logic), this can be achieved with the following code:

Once deployed, you simply create an action (template: /sitecore/templates/System/Workflow/Action) inside a workflow and set the Type string field to the class (fully qualified) followed by a comma and the assembly name (much like you would with pipelines).

The custom action should now run as expected, and you have access to the full item (including it's history - such as who approved the previous workflow step).

No comments:

Post a Comment