I'm working on custom approval workflow. The process assumes that each approver can invite other people for approval. For example, "Hey! We've forgot Tom! He should look at that document!".
The problem is I don't know how to dynamically extend list of approvers without cancelling already created tasks. I'm new to SharePoint workflow development, so any advice or guidance would be appreciated.
In Visual Studio I've created new SharePoint 2013 Add-In project and created a simple state machine workflow:
Start
--> Internal approval
--> External Approval
--> Approved
.
As a trigger for transition from Internal approval
to External Approval
I use ParallelForEach
over Approvers
collection and SingleTask
inside of body.
While the process instance is in Internal approval
and tasks for approvers have already been created I want to add more approvers and create tasks for them. Existing tasks must not be cancelled.
Transition from Internal approval
to External approval
must happen only in case when all created tasks including new are finished.
How can I do that?
Update: Here is an example of what I want to achieve:
- Steve uploads a document to library and manually starts approval workflow. In workflow initiation form he chooses John and Kate as approvers and clicks
Start approval
. - Workflow starts and reaches
Internal Approval
state, creates two tasks for John and Kate. - After looking at the document Kate decides that Tom should also look at that document and creates approval task for him (for example using custom action).
In that case workflow instance can reach External Approval
state only after completion of John's, Kate's and Tom's tasks.