I was recently asked if the out of the box approval process for SharePoint 2010 allowed for individuals to approve documents when an item was sent for approval to a group of people individually which they wanted the flexibility to change each time without relying on the server team to keep adding users to an AD group.
At this point it is worth noting you can achieve what I am about to describe a lot easier if you have all users in one AD group and do not assign a single task to each user. In my case this was not achievable as the client wanted flexibility to add and remove suggested approvers adhoc (assuming they have the approval rights!).
So something always to consider when setting up approval process (or any workflows for that matter) is planning for the ‘what if’s’ and what I mean by that is if you have a rigid approval process where one person is the designated approver – what happens when they go on holiday (or leave)? So my point here is if you leave a little flexibility in your workflow it will give you the room to achieve the end result without lots of pain or reverting to non SharePoint methods of achieving your goal.
So back to the point of my post to my surprise I couldn't find a way to achieve parallel 1 user approval (when multiple people selected to approve) using the SharePoint 2010 Approval workflow.
SharePoint Designer to the rescue, and before you panic there's no code just some tweaks required.
Firstly what you need to do is open SharePoint Designer 2010 (if you don't have this you can download this for free from http://sharepoint.microsoft.com/en-us/product/related-technologies/pages/sharepoint-designer.aspx). Once opened navigate to the site you want to apply the workflow to and simply click on workflows on the left hand side as shown below.
Right click on ‘Approval – SharePoint 2010’ workflow and select copy and modify. Rename the new workflow to something suitable which in my case I called 'Parallel 1 User Approval Workflow’.
Leave content type as all and click ok. Click save from the menu and you will now see your workflow appear in the left hand column (under reusable workflow..
Click on the newly created workflow from the menu.
Click ‘Edit workflow’. You will be presented with Step 1 as shown below:
Click on ‘Approval Workflow Task (en-US) Copy’
I renamed the Task above to ‘Parallel Approval Workflow Task’. I appreciate the menu’s all look a bit the same but do bear with me. So the next step is to click on ‘Change the completion conditions for this task process’.
Now the next screen may look a little intimidating but it’s fairly simple to change!
The next step here is to remove a couple of lines and edit one of the conditions. Simply remove the first 2 conditions from the process by hovering over the drop down and selecting ‘Delete Condition’ as shown below.
Once you have removed the first two conditions you should have a process like below:
Notice that there is a ‘Insert a condition’ at the top. What need to do here is recreate the condition of the first If statement with a slight change, Before we do this we need to arrange the outcome conditions as shown below by moving them up and down until the are at the same level as shown below:
Click on ‘Insert a condition’ then from the menu on the ribbon select condition drop down and this is the important part select ‘If taks outcome equals value’ as shown below.
Next click on the field tab and select ‘Number of Approved’ and in the field value enter 1. So the statement should read:
If Tasks Process Results:Number of Approved equals 1.
So what I have basically changed is how many approvers it takes to meet the condition before setting the document to approved by basically setting the count to 1. Therefore as soon as one approver has approved the document this condition passes and the document gets approved! The great thing here is that all other tasks assigned to other approvers automatically cancel.
Once you have edited your workflow click save and don't forget to publish! If like me you’re running this off a VM on your laptop this may take sometime! If it fails on the first attempt try again.
You will be prompted with an error shown below regarding creating visuals just click ok.
Once you’ve published the workflow back in the browser from the list you want to apply approval, create a new workflow noticing the new workflow appears in the selection list.
Make sure at this stage that content approval is set to on for the list you are about to apply this workflow to. Select the new workflow saved in SharePoint Designer, select the options as shown above giving your workflow a name and click next.
The main point of this exercise is to create a parallel approval workflow so make sure this option is selected from the drop down and also add at least 2 people for the purpose of proving it works correctly.
On the second page make sure when creating the workflow on the list to check the box ‘Update the approval status….’ as shown below:
Next step is to apply the workflow to an item that is in a draft state. Click workflows from the list and select ‘Single Approver Parallel Workflow’.
Click start leaving the defaults.
So now back on the list (in my case a pages library) notice the workflow showing ‘In Progress’
Click on the ‘In Progress’ link and this will show you tasks assigned to Paul and John.
The quickest way to approve the item for test is to approve the document on behalf of the user for the purposes of this test. Click on one of the tasks assigned to the user and click approve. A popup should appear to allow you to approve the item, click ‘Approve’.
Once one of the users has approved the item you should see the workflow progress page as completed (you may need to refresh the page) and the task cancelled next to the approver who didn't get chance to approve the document - see below.
And that's it you’ve now got a parallel approval workflow where only one of the members needs to approve.
As you may know if you’ve reached my blog post there is little documentation on how the workflow works under the hood so I hope you’ve found my post useful.
41 comments:
Well documented and useful
Very succinct and to the point. Excellent resource. Cheers.
Superb .. Thanks for documenting it...
thanks a lot
is it possible to capture who approved the document and send an email to the ones whose task got cancelled since it has already been approved by the other approver??
Hi Rebecca, you should be able to do something with looking up from the workflow history list to be able to copy the approver and add this as a field to the item approved as part of the approval process.
Hi, I'm not sure if I'm doing the way you're suggesting to me. I've set a field under the approval process in task process behaviour like this:
if Variable: isItemApproved equals Yes
set approvedBy to associationList : History List
the field source is set to User ID and my values at the bottom of the Lookup is User Profile : User Name
am I doing the correct way as you suggested?
Hi Rebecca you're on the right lines indeed. I can see where you may have issues with the different field types. Perhaps try a lookup field on the history list to the username then use that field and see if that works.
Paul
Hi, under the history list there is no lookup field to the username. However there is a user ID field and I'm currently using that. Now there's another problem because after I set to associationList : History List, it's a lookup for single line of text and its return field is As String. But when I set to User Profile : Username, the return field is As Integer and I can't set it to As String.
You would need to create a lookup field on the history list as this doesnt currently exist - do make sure this doesnt impact workflows though.
Sorry can you show me the steps on how to create a lookup field on the history list then to capture who approved the document? I'm just a few weeks old to using sharepoint designer :S
Been looking for this for weeks. Top Man
You've just made my day! Many thanks! :)
Hello..I'm new in using SharePoint Designer.i have 2 questions..
1.What are the differences between out-of-the-box approval workflow and approval workflow?
2.I encounter this problem where i have to get approval from different manager from different department.There is drop-down list for user to choose their department.But how to make sure the document is sent to their respective department manager?
Thank You
Hi Nadzira
In answer to your questions:
1. Out of the box would suggest using the UI function as-is where as approval workflow could be a custom workflow (potentially based on the out of the box workflow) that 'approves' but may have some custom functionality applied.
2. This is a little deeper than a quick answer in a comment but at a high level you could have a relationship where the department name has another field associated that is the manager and use SPD to email that manager.
If you are not familiar with SharePoint Designer then point 2 will take you time to figure this out so be patient as it takes time.
Thanks
Paul
Thanks Paul for you reply.I should dig more on SPD :)
Perfect - good stuff - worked a treat
Hi Guido, Glad it helped.
Love it! Thank you!
Does this change also mean that the first REJECTION also completes the task?
@Barry C there is an option to terminate the workflow if a user rejects, see 'End on First Rejection' in the screenshot 15 in the article.
So glad I found this, worked perfectly and solved my problem!
Dianne
Is it possible to add a second level of approver?
When OK for one or more user then the doc pass to second level that approve and publish it.
Hi Marco
Its been a long time since I worked on workflows but from what you're asking I don't see why this isn't possible. Off the top of my head you may be able to add another step in using another column for stage 1 approval then committing the actual approval column for stage 2 or use workflow variables.
Hope that helps
Paul
@Marco Just one further thing to add, if you want to master Workflows start with Penny Coventry (@pjcov)http://sharepointdesignerstepbystep.com/ She has some great books and slideware on this topic.
You have made my day too. Thanks for posting this. This feature was in Moss 2007, but they removed it in 2010. Just to make life difficult I guess.
Thanks for letting me know and glad it helped.
Paul
Note that if you're getting the following error...
"The form cannot be submitted because of an error"
...when trying to use the people picker to assign approvers, as of 30 Nov 2012 the following Microsoft Patches need to be removed from your workstation you have SharePoint Designer 2010 installed on if you've installed them or you will not be successful in using the custom workflow in this tutorial.
KB2553322
KB2687417
After removing these patches (reboot required) then create a new workflow and you should be good to go.
Many thanks Paul - really help me out!
Reference
http://social.technet.microsoft.com/Forums/en-US/sharepointcustomizationprevious/thread/d7ed9665-f847-4c22-b8b8-efa2484e522d
Hi Paul,
Thanks for this very helpful article. I am fairly new to Sharepoint dev but I am learning quickly. I have an addition to this process that I just cannot figure out.
I would like my approvers IE. Marketing to be able to bypass the workflow process. Meaning if it was created by specific person no workflow process is needed.
I have tried to input conditions in the various sections but I just cant get it working the way I want. Any help would be very appreciated.
Hi, I am using Sharepoint Foundation and not Server, so the out-of-the-box Approval workflow is not available to me. I am therefore trying to create my own but have run into a problem:I don't have "If Tasks Process Results:" available to me in SharePoint Designer, is this normal and how can I work around it?
Thanks.
Hi Paul,
Great Post. Thanks.
Is there a way to have a lookup in the 'assign to' field when setting up the approval workflow (e.g. the user's line manager)?
Thank you,
Mania
@ Anonymous 5th December - I personally haven't tried this on Foundation edition so was unaware of these missing actions. Speaking with others I am advised what you are trying to do is quite involved and not recommended in Foundation and to upgrade to SharePoint Standard to achieve the results you need using the enhanced functionality.
@ Anonymous 11th December - Thanks for the feedback, I haven't worked on workflows for a long while now but do remember there being a way to capture the manager information via the user profile properties of that user. I would spend sometime going through the options and you should be able to find it.
Hi Paul,
I have managed to find a satisfying solution for this through the user profile properties in SPD although not exactly what I was looking for,as I wanted to enable the end user to customise the fields of the workflow in the browser.
Thank you,
Mania
Hello, this all would work fine if when I associated this workflow to a list, it would in fact show this workflow in the list of available workflow templates.... Am I doing something wrong? I changed the WF name, saved and published it. I then chose a list and associated the newly created WF to that list. It opened a browser window that adds the WF to that list but when I clicked on "Next" it sent a pop-up message: "Please select a workflow template" (the workflow template list was disabled)
Please help. Thank you so much
Thanks for this very helpful article. I was able to create a "reusable" Approval Workflow (based on the Approval - SharePoint 2010) to do part of what I needed but I cannot figure out why the Approved or Rejected emails only get sent if the Approvers click on the "open this task" within their Outlook email?
My folks work from their calendar in SharePoint 2010. They look at their iPhone and see that there was a request to Approve something and they go to their calendar view Appover/Reject items to either Approve or reject items. They need to "see" the other scheduled items to base their response.
BUT Approving or Rejecting from the SharePoint 2010 Calendar never kicks off the "completion" of the task or workflow and the Approve/Reject emails are never sent to the requestor. The tasks just hang out there....
Is there a way to force emails to be sent when the approve or reject is initiated from the SharePoint 2010 Calendar?
Great article, thanks.
Do you know how I would alter the code to have this work with multiple stages? After testing it with multiple stages, the WF is completed when someone in the 1st stage approves it.
Thanks Dave, its been a long time since I worked with these and don't have a machine to hand. IIRC there is a setting that you uncheck when setting up the workflow that states something like 'stop this workflow if anyone approves'.
I have a question. If the first part of the approval goes to one person and they approve it and then the second part of the approval goes to 2 people (where only one needs approval) should the number of approvals be set to 2. Thank you. This will save me a lot of work
I want to make Travel Request related site on SharePoint 2010. I have some basic plan in my mind how it will. Its like User will fill form (Travel Form) then it will go to his/Her Manager then after approval, it will go to HR department. From here onward, complexity starts as HR will give some preference of Hotel, Flight & rest info for selection to user. Once user select that then it will again go to HR for confirmation of such info & then HR will book flights, Hotel nd rest. So kindly let me know such kind of workflow can be made where multiple loop created with these users for follow up & selection, approval...
Hello,
I am having the below scenario:
1) Admin sends request for meeting to employees using approval workflow.
2) employees either accepts or deny that request.
But the problem is when one user(employee) accepts or deny that request, workflow completes 100% not allowing other users(employees) chance to approve or reject the request.
If I use parallel approach the above problem is happening and can't use serial approach because then other users will have to depend on one employee to make decision then they can.
And In this case all must be free to give their answers without dependencies. How can I achieve that all the users must give their answer and then and then the workflow finish?
Thanks in Advance.
Post a Comment