Get Manager approval in SharePoint Designer 2010 - Step by Step
A fundamental condition that I always encountered when gathering workflow requirement is to get the user's manager approval, a tedious amount of coding to connect to active directory retrieve user profile information, get his manager login name, pass it as a parameter to the workflow, create a custom task for the manager with a notification.
SharePoint 2010 Designer to the rescue, you can do all the above in 15 clicks, with ZERO code involved. Just by doing the following:
- Open SharePoint Designer 2010 and connect to your SharePoint site.
- Click Workflows and select the workflow type you need, for this presentation I'll use reusable workflow with All content types as my scope. But this doesn't affect the following logic, the same steps applies for the List and Site workflows.
- From the Workflow ribbon select Actions > Collect Data from User, you can also select assign a to-do task but collect action from user allows you to create a custom task for the manager
- This will show you the Action in the workflow editor.
- The action is constructed from three parts:
- The data, which is the custom task that will be collected
- This user, which in our case the manager
- Output to variable: collect. Collect is the task ID which you can change it, use it to refer to the task when you need to pass a variable through this task.
- Clicking on data will allow you to create the custom task by starting the task wizard, open the wizard and click Next.
- You will need to specify a Task name, and you can also specify a description. For now lets call the task "Review Task". And click Next
- Now you can Specify the Task custom field by clicking Add and select the field type, I will specify two field:
- Approved as a choice with Yes/No.
- Comment as a text area.
9. Provide the choices values, and hit Finish
- Now it should be looking like this, with both fields listed
- After finishing creating the Task, the condition will change in the editor to reflect the task name.
- Now to the Fun part, getting the user manager. Simply click this user, Select "Workflow lookup for a user...", and click Add
- Now you need to specify data source, in other situation you will need to specify the active directory, create a connection and the rest of this headache. All you need to do now is to select "User Profile" from the end of the list.
- This will display all the user profile attribute that you can select from, such as manager. Select "Manager" and specify the out as "login name". This will lookup for the user manager and return his login name as a parapater in order to assign the task for this user's manager
- Find the list item section allows you to select the user which you need his manager approval. In our case we the manager for the user who started the workflow. So I will select the Field as "Account Name" and click on the formula button in the value field.
16. Specify the data source as workflow Context, the Field source is the Workflow "Current User" , and Return Field as "Login Name". Click OK, OK and OK.
17. The Action should be looking like this now.
Voila, Now you have your custom task that will be sent to the user's manager with a notification in his task list.
Enjoy.
Comments
Anonymous
January 01, 2003
@Linda - Rejected or Failed? @Moazzam - If the calendar list share the same site as the vacation list you can update the calendar by a workflow action - update list item. @ Steve - the data will be in the task list @Sean - Can you elaborate more? do you mean the workflow starts but when the task assigned it produce an error?Anonymous
January 01, 2003
@Ron - The user profile holds the attributes of the OUs in the AD, so if you want to look up for something in the AD such as department name or Manager name or a title, we will use the user profile. @7ogait - hope it worked for you by now.Anonymous
January 01, 2003
Exactly, despite of the authentication model, the AD should be connected and user profile services should be activated in SharePointAnonymous
January 01, 2003
Very nice post! However, it seems that this solution won't work without AD. Am I right to assume that if there's not Active Directory present, I'm still gonna need to jump all the hoops and code?Anonymous
January 01, 2003
The comment has been removedAnonymous
November 09, 2010
All of this is dependent upon the User Profile Sync within Sharepoint isn't it? So it is required to connect to AD to retrieve all of ther user profiles.Anonymous
December 02, 2010
Thank you for this article. This made my job in getting a standard workflow in SharePoint with employee-manager relationships so much easier. I really appreciate the directions!Anonymous
December 17, 2010
hi nabil, u r article is good but in case if i m not having actvie directory,how can i create a approval workflow in my case i need to create a leave form,in which when a employee requsts for leave ,the list must me sent to manager and id manager approves it must be sent to hr,how can i create this i dont have active directory option plz helpAnonymous
January 11, 2011
This workflow works well. Once in place however, the list it is associated with can only display the task completion status; not the approval status. This isn't overly helpful since a rejection completes the task as well as an approval. Do you have any suggestions on how to utilize this workflow in a way that the approval is visible on the originating list?Anonymous
July 18, 2011
Each time I use this workflow, the item is rejected. What am I missing?Anonymous
August 07, 2011
Hi, if after approval, i need to update the company calender so all employees can view the calendar and see leaves etc. How can it be done automatically once manager for example approves a request of leave by an employee. ThanksAnonymous
October 31, 2011
How do I get the data collected out of the workflow?Anonymous
November 18, 2011
I've followed the instructions but getting an error on Review Task, any idea? How do I find out what the error means?Anonymous
November 23, 2011
Can anyone please help me out. how would i get the responce back to the workflow variable, so that i can perform some operation in the workflow depending on what the user selected in the choice?Anonymous
December 30, 2011
Great article but when I tried it I don't understand why I don't have "User Profiles" as a data source option. Help!Anonymous
January 06, 2012
"I don't have "User Profiles" as a data source option. Help!" i have the same problem in Foundation 2010Anonymous
January 23, 2012
@7ogait.. Check if your "user profile service" and the "managed metadata service" applications are up and running and also if they are associated with the webapplication in which you are trying to create the workflow.Anonymous
April 11, 2012
The user profile service isn't part of SharePoint Foundation so this solution only works with SharePoint Server Standard or Enterprise.Anonymous
April 16, 2012
Hello, I did what is mentioned here. when i check the tasks i see that the assigned to field of the task is null why ? Shouldn't bee the manager name ?Anonymous
April 23, 2012
custom user profile properties are not comming Field from source,Please help us how do we get custom user profile propertiesAnonymous
June 22, 2012
Hi, This is great. How do I add/sub the vacation days to to an exel file.Anonymous
July 31, 2012
Hi, 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 YouAnonymous
August 23, 2012
Hi, That is really great. However, I have the following questions:
- Should I grant managers any permissions to be able to approve the task?
- How can I associate the workflow to a list and make it work automatically?
Anonymous
September 30, 2012
Does anybody know how to do a lookup a manager of a selected department? (Not the manager of the current user)Anonymous
October 02, 2012
Each time I use this workflow, the item is error occurred .what am i missing ? and i actived user profile services in central admin SharePoint plz help meAnonymous
March 08, 2013
IT'S WORKS!! IT'S wORKS!!!! Thank you from the bottom of my heart!... However... Please help me set up the confirmation emails that need to go to the employee that says their time was approved or rejected and same type of email to the manager... I have the emails set up as workflow content:initator and user profiles:Manger.. what am i doing wrong??Anonymous
March 21, 2013
I really need an answer to my question. Please help me.Anonymous
April 01, 2013
Could you please share your answers for setting the Approval? I am stuck.Anonymous
April 08, 2013
The comment has been removedAnonymous
April 29, 2013
Hi, Muhammed thanks for your article, In step 13 I don't have user profile in data source ,what should I do? RegardsAnonymous
June 17, 2013
Hi Muhammed, Sincere thanks for posting this article. My next query is how to get approval from 2 more level of managers. Please help me out of this. Thanks in Advance. Prajwal KulkarniAnonymous
June 12, 2014
Hi Muhammed
This works great thanks I have two questions
Is there a way to set something in the workflow that allows the manager to click and approve and that this be sent to the user?
Also how do you display the fields in the mail like the leave start date and the type of leave on SharePoint
Please advise
regardsAnonymous
February 11, 2015
I have sharepoint foundation so do not have User Profiles as a choice. I am going to add a Manager column to the library in the meantime. What have others done?Anonymous
March 17, 2015
Hi Nabil,
Great work, i have little problem, in Association Task list approver's comments field did not show entry which he enter during approval. any idea how to get input comments in "Association Task" list fieldAnonymous
June 10, 2015
Do you know what the lookup fields would be if a manger wanted to route for approval from his/her direct reports?Anonymous
October 28, 2015
The comment has been removed