Social media


            

Wednesday, June 17, 2009

Different models of approval workflows - voting approval


In the previous posts I have described the first answer applies workflow and multi-approval/multi-reject workflow.

In this scenario a number of rejection votes or approval votes are needed to approve or reject the item. For example – 3 approvals are needed for the item to be approved and 2 rejections are needed for the item to be rejected.  
Note that when setting up this kind of scenario you need to make sure that the voting algorithm will not cause a clinch where item cannot be accepted nor rejected. If you have 6 or more users, then 3 approvals or 2 rejections model is fine. If you have less than 6 users, then in some situations workflow could end in dead point. 
To create a workflow that will meet this scenario:
  1. Create a role "Approvers" and add selected users (you can assign users, domain groups or SharePoint groups). You can also add users later on with the activity "Add to role".
  2. Create a state "Waiting for approval".
  3. Add four actions – two named "Approve" and two named "Reject". One “Approve” and one “Reject” action must lead back to the “Waiting for approval” state (we are creating a loop). The other pair can lead to where you want, for example to the ending state.
  4. Assign the "Approvers" role to all “Approve” and “Reject” actions.
  5. Create 2 variables – “Approved votes” and “Rejected votes” – set both to “integer” type.
  6. In the looping actions add “Add to role” activity. Use it to add the “Current user” (use lookups to go to SharePoint -> Current -> Current user) to “Denied” members of the “Approvers” role. Note: use activity clipboard to copy the activity.
  7. In the looping “Approve” action use the “Set variable” activity to set the “Approved votes” variable to “Approved votes”+1.
  8. In the looping “Reject” action use the “Set variable” activity to set the “Rejected votes” variable to “Rejected votes”+1.
  9. In the non-looping actions add “Approve/reject item” activity and set it to approve/reject the current item.
  10. In the looping “Approve” action set action launch conditions to “Approved votes < 2”.
  11. In the looping “Reject” action set action launch conditions to “Rejected votes < 1”.
  12. In the non-looping “Approve” action set action launch conditions to “Approved votes >= 2”.
  13. In the non-looping “Reject” action set action launch conditions to “Rejected votes >= 1”.
What's going to happen in the workflow:
  1. Workflow enters the "Waiting for approval" state
  2. Members of "Approvers" role have 2 looping actions "Approve" and "Reject" – both “Approved votes” and “Rejected votes” variables are smaller than 2.
  3. Until two people chose “Reject” or “Approve” only the looping actions are available
  4. Every time the looping action is launched, a vote counter is raised by one and the workflow is entering the “Waiting for approval state”
  5. If 2 people have approved, then the looping “Approve” action will disappear and the other “Approve” action will be visible. This way the third approval action will be the one doing the final approval.
  6. If someone has already rejected, then the looping “Reject” action will disappear and the other “Reject” action will be visible. This way the second rejection action will be the one doing the final rejection.
  7. When the non-looping action is launched, workflow exits the "Waiting for approval" state and item approval status is set to “approved” or “rejected”.

Tuesday, June 16, 2009

Different models of approval workflows - one approval, one rejection

In this post I will continue the previous post about different approval workflow models. There I showed how to create a "First response applies" workflow.


2) One approval 
In this scenario we need only one approval to approve an item, but to reject it we need all approvers to reject. This means if anyone approves - the item is approved. But the item is rejected only after the last person from the approvers rejects the item. 

Download the workflow definition
See a screencast on how the workflow is defined.

To create a workflow that will meet this scenario:
  1. Create a role "Approvers" and add selected users (you have to use NAMED users, do not use domain groups or SharePoint groups, later on you will see why). You can also add users later on with the activity "Add to role".
  2. Create a state "Waiting for approval".
  3. Add three actions "Approve", "Reject" and “Final rejection”. “Approve” and “Final rejection” can lead to where you want, for example to the ending state. “Reject” action must lead back to the “Waiting for approval” state (we are creating a loop).
  4. Assign the "Approvers" role to “Approve” and “Reject” actions. Remove permissions for everyone from “Final rejection”.
  5. In the “Reject” action add “Remove from role” activity. Use it to remove the “Current user” (use lookups to go to SharePoint -> Current -> Current user) from the “Approvers” role.
  6. In the “Approve” action add “Approve/reject item” activity and set it to approve the current item.
  7. Copy the activity to clipboard
  8. Open the “Final rejection” action and drag the activity from the clipboard. Change approval status to “Reject”
  9. Open the “Waiting for approval” status and click “Self-timer” button.
  10. Set self-timer to launch the “Final rejection” action 0 minutes after workflow enters this state. In the conditions set that the “Allow” membership of the “Approvers” role must be empty. Note: if you are using a workaround, the membership must be equal to “empty”.
What's going to happen in the workflow:
  1. Workflow enters the "Waiting for approval" state
  2. Members of "Approvers" role have 2 actions "Approve" and "Reject". “Final reject” is not visible, as they do not have permissions to launch it.
  3. If anyone from the approvers launches the action “Approve”, workflow exits the "Waiting for approval" state and item approval status is set to “approved”.
  4. If someone from the approvers launches the action “Reject”, then this person is removed from the “Approvers” and cannot launch any actions anymore. Workflow returns to the “Waiting for approval state”.
  5. Every time the “Reject” action is launched, workflow is entering the “Waiting for approval state” and self-timer condition is checked.
  6. If the person doing the rejection was the last approver in the role (everyone else already has rejected), then the role membership is empty. Self-timer condition is met, so the self-timer action will be launched. This is why you need to use named users – otherwise you would not be able to check if all members of a group have already rejected. Note that because timer is launched by SharePoint job action “Final rejection” will not be launched momentarily – it can take up to 5 minutes.
  7. “Final rejection” action is launched, workflow exits the "Waiting for approval" state and item approval status is set to “rejected”.
 3) All must approve 
In this scenario we everyone to approve the item. One rejection is causing the item to be rejected. This means if anyone rejects - the item is rejected. But the item is approved only after the last person from the approvers approves the item.

As you can see this scenario is exactly the same as the “One approval” – only the “Reject” and “Approve” are switched. Switch “Approve” and “Reject” action names, change “Final rejection” name to “Final approval” and change the activities between “Reject” (previously “Approve”) and “Final approval”.

Next post (voting approval)

Different models of approval workflows - First response applies

We have received a number of questions regarding different approval models. Workbox does not offer any predefined workflow models, but allows you to create a workflow that completely suits your needs. We have defined some sample approval workflows that might help you get an idea how to define your own approval workflow.


In this and following posts I will focus on 4 most common ones:
  1. First response applies
  2. One approval (2nd post)
  3. All must approve (2nd post)
  4. Vote (3rd post)
Below I will show you how to implement each of these scenarios on any list.

For every scenario there is a workflow definition file for you to download and use. It will help you understand how the workflow is configured.

I have used a list with content approval turned on, to give you the idea when item is accepted or rejected. In the final approving or rejecting action I have used “approve/reject item” activity. This is just an example of what you can do in the approval actions and it is not required for the workflow to work properly. 

1) First response applies 
This scenario is really simple - decision of the first approver counts. This means if anyone approves - the item is approved. If anyone rejects - the item is rejected. 

Download the workflow definition
In this scenario all you have to do is:
  1. Create a role "Approvers" and add selected users (you can use users, domain groups or SharePoint groups). You can also add users later on with the activity "Add to role".
  2. Create a state "Waiting for approval".
  3. Add two actions "Approve" and "Reject", that lead to where you want, for example to the ending state.
  4. Assign the "Approvers" role to both actions.
  5. In the “Approve” action add “Approve/reject item” activity and set it to approve the current item.
  6. Copy the activity to clipboard.
  7. Open the “Reject” action and drag the activity from the clipboard. Change approval status to “Reject”
What's going to happen:
  1. Workflow enters the "Waiting for approval" state
  2. Members of "Approvers" role have 2 actions "Approve" and "Reject"
  3. After anyone from the approvers launches the action, workflow exits the "Waiting for approval" state and item approval status is set to either approved or rejected.
Next post (one approval, all must approve)