Workflow: Next Approver is my VP

This can be done with a SharePoint 2010 workflow in SharePoint 2010, 2013, or SharePoint Online, but it cannot be done with a SharePoint 2013 workflow.

Many times in approval workflows, the first approval needs to go to the employee’s manager, and then the next approval is supposed to go to the VP of that department.  The VP isn’t necessarily going to be your manager’s manager, though.  In SharePoint Designer 2010 workflows, information about users can be obtained within the workflow, which lets you look up, say, job title information.  This means that we can look to see if a manager has the text “VP” in their job title, to see if that’s the next person to route the item to for approval.

Your user profiles do need to have accurate information, in this case especially in the Manager field and the Job Title field.  Also, in this example I’m assuming that there won’t be any more than 4 levels between the workflow initiator and the VP of that department.  You can see the pattern that’s used and just add more levels if you need to.

As a very simple example, we have an item that routes like this:

  1. Initiator’s manager for approval
  2. The VP above the initiator’s manager for approval

After the VP’s name has been obtained, you can pretty much do whatever you need to do in the workflow, such as send them an email or assign a task.

First, the following is the list of variables to create in the workflow:
88-ch513_19003434.png
Then, these are the high level steps to go through:

Workflow Steps:

Find Manager of Current Item: Created By (output to Variable: manager)

IF User Profiles:Job Title (of the manager) contains VP

Set Variable:VP to Variable: Manager

Else

Find Manager of Variable: Manager, output to variable: SecondLevelMgr

IF User Profiles:Job Title (of the 2nd level mgr) contains VP

Set Variable:VP to Variable: SecondLevelMgr

          Else

Find Manager of Variable: SecondLevelMgr, output to variable: ThirdLevelMgr

IF User Profiles:Job Title (of the 3nd level mgr) contains VP

Set Variable:VP to Variable: ThirdLevelMgr

               Else

Find Manager of Variable: ThirdLevelMgr, output to variable: FourthLevelMgr

IF User Profiles:Job Title (of the 4th level mgr) contains VP

Set Variable:VP to Variable: FourthLevelMgr

Now that you see the gist of how the workflow goes, I’ll get into some details about a couple of the actions used.

On each line that starts with IF, these are the steps to lookup that manager’s job title:

  1. Add a new condition called If any value equals value
  2. Click the first Value word, and click the little function button next to it.
  3. The data source is “User Profiles”, and field is “Job Title”.  In the section called Find the List Item, you’re matching up the Account Name with the variable called manager.88-ch514_19003434.png
  4. When you click the function button next to the Value of “Find the list item”, use the following settings:88-ch515_19003434.png
  5. Click OK to both of these dialog boxes, and you’ll be back on the workflow.  Click the word equals and change it to CONTAINS and then type VP in the box for the second value.  Therefore…
    88-ch516_19003434.png

Okay, so that’s the most complicated part of the workflow, the job title lookup.  All the other steps are pretty much just as they’re written in the Workflow Steps text above.  I do like to use the “log to history” action a lot in my workflows, which helps with troubleshooting.

Here’s an entire screenshot of the workflow in SharePoint Designer 2010.  Click to enlarge:

You’ll notice that I did put a bunch of logging in there.  Again, this workflow doesn’t DO anything in its current state, except obtain the VP’s login name and store it as a variable.  For this to be useful, it would just be a part of a bigger workflow.  You can send an email to the VP (the variable), or assign them a task, etc.

Advertisements

17 comments

  • A trick we use because our user profiles are not set up to allow that kind of checking is to create a custom list to act as a routing table for our cost centers. It can be used by InfoPath or a SPD workflow. For example, there’s a cost center number, the cost center name, a manager’s name (First Name, Last Name), their AD account (person field), their approval manager’s name, the approval manager’s AD account, and a few other things that are specific to our organization. Start by selecting the correct cost center for what ever you need to do, and the form or workflow uses the routing table to send it to the correct approver in the correct order. We have it so you can begin with a supervisor and up with the Board of Directors. Staff change? Update the routing table, leave the forms and workflows untouched.

    Like

  • manny chohan (mannychohan@gmail.com)

    Hey Laura, I love your articles as they provide great insight into how to do lots of things in SP. I have a situation much similar to this blog post but the issue is that I am using Sharepoint Foundation and I am not able to tap into the UserProfile statement while creating workflow. Is there any workaround this issue? Thanks Manny

    Like

  • I could not find ‘User Profiles’ in Define Workflow Lookup’s Data Source field..Could you please help me..

    Like

  • Faw, Yes, that’s definitely a feasible alternative. Manny, Try doing what Faw said. San, If you don’t see it, that usually means you’re not running the enterprise version of sharepoint 2010.

    Like

  • Charming Laura, I’m trying something similar to what you outline here but am seeing an error in the 14/logs when the workflow runs: “The user does not exist or is not unique”. I confirmed the manager variable was correctly being set for CurrentItem:CreatedBy with a log entry (“DOMAIN\FLastName” was logged) and I confirmed I’m specifying the Return field as “Login Name”. I’m suspecting setting the Approver value with the manager variable is where this error is occurring (or possibly it is not being set), but would like to see if you have any insight on this. I’ve modified the OOTB Approval workflow and before Step 1, I’ve added the step to set the Parameter:Approvers to the managers that looks like this: Find Manager of “Current Item:Created By” (output to Parameter:Approvers) Is placing steps before the first overall workflow task not setting the Approvers value soon enough? I’ve included a link to a forum entry where I’ve investigated other possible reasons for the error.

    Like

  • Robert, I don’t know, but here’s how you can troubleshoot it. Set logging in the WF. add this action: Log to history: “the manager is… [then add the lookup to the user’s manager] That way you can see what it’s returning, before you try to send an email or anything.

    Like

  • Nice work Laura.. keep it up

    Like

  • Hi Laura, First of all, I love your blog. It helped me a lot. I have a question: I’m using SPD 2007; do I need to change something in this workflow? I’m trying to combine this workflow with your article “InfoPath User Roles in Browser-Based Forms- Another Way”. Do you have any suggestions about how to do that? Thanks in advanced. RG

    Like

  • RG, Use the userprofileservice.asmx with the GetUserProfileByName operation. Pull in the user’s Title property. Then you can do a rule on any control that looks to see if Title contains “VP”.

    Like

  • Hi Laura, I am having the same issue as San where I cannot find ‘User Profiles’ in Define Workflow Lookup’s Data Source field. We are running SharePoint 2010 Enterprise. Any other ideas as to why this is not running? Our user profile service is running and my sites are working.

    Like

  • Darren, Make sure that the sharepoint enterprise site feature is activated on your site.

    Like

  • Hi all, I need create workflow is sending email to project manager if his project is approved. In sharepoint designer 2010 I don’t know how to do it. I really need any help

    Like

  • Hong,
    This is pretty simple, and there’s a way to do it without a workflow:
    https://wonderlaura.com/2009/2/11/alerts-based-on-views

    Like

  • Laura, I have a list which I am trying to use like FAW, and want to match a field from the document uploaded metadata field – If it contains this than the approval goes to a certain person. However there are over 12 categories each go to a different person. I cannot get the value of the field to send an email from the list even when they are matched. (Separate list looking a lookup field) How can I do this?

    Like

  • Hi Laura,
    I’m not a good programmer, I guess you can help me out. I need to do the following:

    • Person A creating a document and saving in a location, and an alert being sent to person B
    • Person B checking the document and making any comments then signing it off as checked, an alert being sent to person C
    • Person C checks the document and signs it off as final check, with comments and then locks the document as final

    Can you give me step by step process to do this.

    Like

  • France,
    You can try using variables in your workflow. If the approval level is X, then set the variable “ApproverVar” to xyz Person’s name. Do all 12 like that, and then you can send a single email in the workflow, where you just place all the variables’ values in the email.

    Grenald,
    Since that’s a very specific situation that we’d need to talk through, I recommend you coming to our SharePoint Power Hour any Wednesday at 11 Central and ask us questions live.

    Like

  • Excellent post. This is how I was imagining the build of the workflow, but did a quick google search found your article to confirm is was the right way 🙂 Thanks!

    Like

Leave a reply or question

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s