2

We have a implemented workflows and in a particular scenario when the component is being imported through Content Porter, I am finishing workflows forcely by using below code snippet:

var processInstance = new ProcessInstance(component.CurrentActivity.Process.Id, session);
processInstance.ForceFinish(new ApprovalStatus(session));

However, this leaves the component in "Unapproved" state.

As a result the page containing this component cannot be published as we have minimum approval status set at Publication Target.

To leave the component in "Undefined" state,I have tried using below lines:

processInstance.ForceFinish(new ApprovalStatus(new TcmUri("tcm:0-0-0"), session));
processInstance.ForceFinish(null);

But no luck, has anyone done something like that?

We have Tridion 2013 SP1.

Thanks in advance.

  • The requirement is not clear, Can you please add the exact requirement in detail. Also mention the tridion version you are using. – Sayantan Basu Aug 2 '16 at 6:01
  • Hi @SayantanBasu, I am finishing WF in case of Content Porter which leaves component in "Unapproved" state and I want to set as "Undefined". – Yash Aug 2 '16 at 6:38
2

I don't think you can finish a workflow, even programmatically, as "Undefined". Undefined means that the component has not been the subject of a workflow.

What you'll have to do is finish the workflow as an approval status that is at least the minimum approval status for your publishing target (To me, this makes some sense anyway, as your code is effectively approving the content).

  • Thanks David, bt I don't wnt the comp imported via CP to go again thru WF again, hence I wanted to set "Undefined", other option I can do is to set max approval status which let Comp to be published Live. But in this scenario, the prob is that if Comp is then edited manually, the status changes to "Unapproved" until you finish the first activity (1st task is manual) and once the activity is finished Component gets the last status i.e. max approval until you start the next activity. That means the comp being in WF can be published to Live between state of 2 activities which shouldn't happen. – Yash Aug 2 '16 at 11:40
  • I'm not sure I understand your comment. It seems to be at odds to your original question. I understood that you wanted to forcibly finish your workflow, leaving the component in a state in which it could be published. That is (or should be) a separate operation to when an editor makes an edit to your component. If it is not, then perhaps you need to revisit your workflow design? – David Forster Aug 2 '16 at 13:00
  • Hi @David, I think you are right that we may not be able to set the approval status as "Undefined" programmatically. This indeed answer my question, however I went a step ahead in my previous comment and hence confused you. I will post another question for that. Thanks. – Yash Aug 3 '16 at 12:51
6

The Import/Export Service (as used by Content Porter) will set Session.ContextData so Event Handlers can detect that the Events are triggered by a Content Manager Import action.

You could catch that the content has been added via Content Porter and push through a specific (automated) branch of the workflow to set the approval status (and any other actions required).

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.