We have a workflow enabled at schema level, and the moment new component is being created the workflow locks the component for the further approval tasks described in the workflow.

As we also need the locked component to be added on the page, which we can’t do on the minor version of the component, so we have written the following code to increment the component version by 1:

OnSaveEvent(EventPhases.Processed) of Component – we perform the following logic:

var processInstance = new ProcessInstance(subject.CurrentActivity.Process.Id, session);
processInstance.ForceFinish(new ApprovalStatus(session));
var newSubject = new Component(subject.Id.GetVersionlessUri(), subject.Session);

The entire logic works fine when anyone creates a new component in Content Manager and the component gets locked by the workflow again after save operation.

However, when any new component is being imported using the content porter the code gives the below error:

Error Tridion.ContentManager.ItemDoesNotExistException: The item tcm:6-205283-16-v0 does not exist.

The API says, “All the Subjects of the related Work Items will be checked-in after a force finish”, so ideally the Content Porter should get the major version then why am I getting the error for minor version?

To differentiate the component creation from Content Porter vs Manual, I already tried to put a check if (subject.Session.ContextData.ContainsKey(TcmApplicationId.ImportExportService))

and execute the above code until force finish, as I don’t want the component to be locked by the Work Flow again, but still no luck. Can someone provide any clue what else we can try?


  • Is tcm:6-205283-16-v0 the item you're importing or maybe a dependency that the imported item needs? The docs describe a few options, including what I think you're doing in your "content porter vs manual" check. May 27, 2016 at 8:55

2 Answers 2


A bit long for a comment but - as you state the process is this

  • user creates a component
  • component save saved as 0.1 and
  • component is added to workflow according to the associated component process selected
  • At this point, the 'Owner' is the account that created the content and it will be 'Assigned' to that account

As Harald states, only the owner can see the minor version ('Revision') when the item is in an active workflow process.

So ... back to your code... when do you run this against the newly created workflow item (is this an event system action - are you forcing a full version automatically - if so, doesn't this invalidate workflow and the approval status concept?).

It's Force-Finished so it's now V1.0 (that's what the code / documentation says - I presume you've confirmed the version in your export in 1.0).

In the GUI the item should no longer show as locked (the padlock in the lower right for the component icon is removed) and it will no longer be shaded gray to show it's not really a 'full' component - ready to go into battle with pages, templates and the like.

When you look at it at this point are you seeing version 1.0, is it in another workflow process?

Is it the same user performing the Content Port that has the item locked out (if it's locked out)?


  • Thanks for all your replies, I tried to invoke the logic on SaveEventArgs(EventPhases.TransactionCommitted), which solved the issue. However, still trying to figure out what really happened behind the scene after this change. Thanks
    – Yash
    May 31, 2016 at 13:50

I am not sure I totally understand the question, but once a component is locked in the workflow, then the version of the component seen by anyone other than the current workflow task assignee will be the version of the component prior to when the entire workflow process was started. From the sounds of it, the "minor version" does not exist yet because it is locked in the workflow, and will not exist to other users until the workflow process has completed.

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.