1

I want to rollback the published content in workflow process when the approver reassign workflow to Editor. is there any default way to do that in tridion with event listener?.

if yes, is this the only way i can do ?.

http://docs.sdl.com/LiveContent/content/en-US/SDL%20Tridion%20full%20documentation-v1/GUID-2684D4D9-BFAE-483D-8218-1CDDEBE90A70#docid=GUID-96ED9915-6B71-414F-8137-F6F47DC2F4D7&filename=GUID-96ED9915-6B71-414F-8137-F6F47DC2F4D7.xml&query=&scope=&tid=&resource=&inner_id=&addHistory=true&toc=false&eventType=lcContent.loadDocGUID-96ED9915-6B71-414F-8137-F6F47DC2F4D7

  • The undo feature is indeed meant for reverting changes delivery-side by "undoing" the results of a recent publishing transaction in Workflow. But you would use it an automatic activity rather than when (just) reassigning an activity. Undo might not fit your use case, though. What should happen to the Content Manager-side minor version that the "approver" rejects? – Alvin Reyes Dec 2 '15 at 22:40
2

As Alvin suggested, I also think automatic activity is the best way to fulfill your requirement -

When your approver reject the item instead of reassign it to editor, assign it to a automatic activity.Then write a script which will un publish your item first and then send your activity back to editor. The whole thing is manageable from the script itself. I have implemented the below code for your reference. It is only applicable for pages. You can modify as per your requirement -

 protected override void Execute()
    {
        UnPublishInstructionData unPublishInstruction = new UnPublishInstructionData();
        unPublishInstruction.ResolveInstruction = new ResolveInstructionData();

        //Needed for publishing workflow revision/version
        unPublishInstruction.ResolveInstruction.IncludeWorkflow = true;
        ActivityInstanceData activityInstance = ActivityInstance;
        IList<String> itemsToPublishList = new List<String>();

        //Staging publication target URI
        String[] targets = new[] { "<specify your target type>" };
        foreach (WorkItemData wid in activityInstance.WorkItems)
        {
            int value = Convert.ToInt32(Enum.Parse(typeof(ItemType), "Page"));
            if (wid.Subject.IdRef.EndsWith(value.ToString()))
            {
                itemsToPublishList.Add(wid.Subject.IdRef);
            }
        }

        //PublishTransactionData requires reference to System.ServiceModel
        PublishTransactionData[] publishTransactions = CoreServiceClient.UnPublish(itemsToPublishList.ToArray<String>(), unPublishInstruction, targets, PublishPriority.Normal, null);

        //Store the publish transaction id so that we can undo if needed!
        ProcessInstance.Variables.Add("PublishTransaction", publishTransactions[0].Id);


        CoreServiceClient.FinishActivity(ActivityInstance.Id, new ActivityFinishData { Message = "Reassign the activity to Editor" }, null);


    }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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