We created two visual studio workflows, say, workflow A and workflow B. Workflow A starts when a document is added or changed and check out the document. We can’t start Workflow A manually. Workflow B can only be started manually. When we try to start workflow B on a document which is already checkout by the workflow A, following pop up appear:
This workflow requires that the document is checked in. You must first check this document in and then start the workflow
If we check in the document, workflow B works fine.
As per my understanding, the trick missing is that SharePoint workflow run with “System Account”. We have deployed two workflows. Workflow A and workflow B. First Workflow A run when document is uploaded or changed and check out the document. Document is checked out using current user token (user token of the user who has uploaded or changed the document). When we want to start Workflow B, it give us error that document needs to be check in as it was check out by another user and we can’t run workflow on it.
We changed the code of Workflow A and used system account to Check out the document. Now, when user try to run the workflow, it is already check out to “System Account” and have no issue in running.