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:
- Initiator’s manager for approval
- 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:
Then, these are the high level steps to go through:
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
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
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
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:
- Add a new condition called If any value equals value
- Click the first Value word, and click the little function button next to it.
- 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.
- When you click the function button next to the Value of “Find the list item”, use the following settings:
- 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…
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.