Here is my Business Process for which I am authoring this workflow.
- An admin creates a list item with "Responder" people field filled out. The person referred to in the "Responder" field will receive a notification informing him that he need to complete the list item with other fields that were left blank by the admin ( he just need to receive the link to the Edit form of the list Item).
- Due Date is calculated based on Item created Date. It is usually 5 days from the Created date.
- The Responder should start getting reminder emails if he did not complete the form 3 days before the due date and should continue to get the reminders until he is completed with the task.
- The Flexi task will have the outcomes of "Completed" and "Rejected".
- The Responder or admin should be able to delegate the task to other users.
- If the Responder selects "Completed", then it should send an email to the initiator that the task is completed and set the field "status" = "Completed" of the list item that started the workflow . However, if the responder selects "Rejected", then it should send a reject notification and set the field "status" = "Rejected". When the Status field is updated to "Reassigned", the task should be reassigned.
Approach Followed (please suggest a better way to do this, if what I did below doesn't make sense).
I used State Machine and Change State Machine actions for what I want to achieve. Please see the swim lane below and the steps for my workflow are as follows.
1) I defined two states: "Task Assignment" and "Initiator".
2) The task is assigned in the first state of the state machine action i.e "Task Assignment".
3) There are couple of variables that are calculated prior to Assign Flexi task assignment (due Date and Assignee Display name).
4) There are two possible outcomes for the Assign Flexi Task (Complete and Rejected).
5) If the outcome is "Complete", then the status field of the list item that initiated workflow should be updated to "Complete" and send a notification to the initiator and ends the state machine followed by "End Workflow" action.
6) If the workflow outcome is "Rejected", then the status field of the list item that initiated workflow should be updated to "Rejected" and Change the state to "Initiator" (on the right side in the below swim lane).
7) once the state is changed to the initiator, a notification should be sent to the initiator that the task has been rejected.
8) Then, it should wait until an Item is updated and Status field of the list item is changed to "Reassigned" and then Change the state to Task Assignment and assign the task again.
The issues am having with this approach is:
- When an Assignee selects the "Rejected" outcome of the task, the list item's status field is not updated to "Rejected".
- The entire logic below Rejected Outcome from Flexi Task is being ignored which means "change state to initiator" is also being ignored.
Please advise why this is happening or is there a better way to achieve this?