Is there a pipeline / event available which I can plug into to execute custom code when workflow state changes for any item?

  • How is this question different from sitecore.stackexchange.com/questions/14071/… ? Can you be more specific about your issue, otherwise this one might be marked as duplicate..
    – Gatogordo
    Sep 26, 2018 at 14:20
  • 3
    The question is different because the previous question is how to change workflow states programmatically.. This is asking how to execute code when a workflow state is changed. Sep 26, 2018 at 14:37
  • 1
    Indeed - luckily @PeteNavarra is more awake than I am :)
    – Gatogordo
    Sep 26, 2018 at 14:45

1 Answer 1


There's no pipeline or event that you can plug into in the general sense of Sitecore's pipelines and events that you see in the ShowConfig. Instead, it's driven by an Item based pipeline provider.

This is accomplished by creating what's called Workflow Actions that allows you to execute code when a workflow is changed to that state.

There's an example of this in the Standard Workflow that comes with Sitecore.

enter image description here

1) Create a new item under the Workflow State that you want the action to execute on using the /sitecore/templates/System/Workflow/Action template.

2) Create your Custom Code like the PublishAction.

  public class PublishAction
    /// <summary>Runs the processor.</summary>
    /// <param name="args">The arguments.</param>
    public void Process(WorkflowPipelineArgs args)
      Item dataItem = args.DataItem;
      Item innerItem = args.ProcessorItem.InnerItem;
      NameValueCollection urlParameters = WebUtil.ParseUrlParameters(innerItem["parameters"]);
      bool deep = this.GetDeep(urlParameters, innerItem);
      bool related = this.GetRelated(urlParameters, innerItem);
      Database[] array1 = this.GetTargets(urlParameters, innerItem, dataItem).ToArray<Database>();
      Language[] array2 = this.GetLanguages(urlParameters, innerItem, dataItem).ToArray<Language>();
      bool compareRevisions = this.IsCompareRevision(urlParameters, innerItem);
      if (!Settings.Publishing.Enabled || !((IEnumerable<Database>) array1).Any<Database>() || !((IEnumerable<Language>) array2).Any<Language>())
      PublishManager.PublishItem(dataItem, array1, array2, deep, compareRevisions, related);

3) Set the Namespace and Class name of your custom code to the Type string field.

4) ???

5) Profit! Now when an item changes to that workflow state, the custom code will execute.

  • 2
    Technically it is a "pipeline", just the database version. sitecorerap.wordpress.com/2018/05/31/…
    – jrap
    Sep 26, 2018 at 15:41
  • That's fair. It's just not seen as much... since you don't see it in the ShowConfig like other pipelines. But you are not wrong. Sep 26, 2018 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.