Search code examples
c#asp.networkflowsitecoresitecore-workflow

How to move a item from 1 workflow to another workflow and then back to the 1st workflow in Sitecore?


I am trying to link 2 workflows together:

Item is created/edited in workflow "A". When that item is submitted it goes to workflow "B" for approval. Once it is approved it goes into approved state in workflow "B".

What I want is for the item to go back into workflow "A" after it is approved by workflow "B". Is this possible? if so how?

(using sitecore 7.2)


Solution

  • It sounds like a custom Workflow Action will do the trick. Assuming that your item has Workflow A configured as the Default Workflow on the template's standard values, all this workflow action would need to do is add a new version. The new version will be automatically placed into Draft state in Workflow A.

    public class AddVersionWorkflowAction
    {
        public void Process(WorkflowPipelineArgs args)
        {
            // TODO: check for nulls, assertions, etc.
    
            args.DataItem.Versions.AddVersion();
        }
    }