SharePoint Designer workflow to lookup manager of manager for InfoPath people picker

Learn how you can create a SharePoint Designer 2010 workflow that can lookup the manager of the manager of a user that is entered into a people picker control on an InfoPath 2010 form.

You can use SharePoint Designer 2010 to create workflows that run on InfoPath forms stored in SharePoint without having the need to write code. While such workflows have their limitations, you can do astoundingly a lot with them.

The following InfoPath video tutorial shows how you can create a SharePoint Designer 2010 workflow that runs on an InfoPath form that is submitted to a SharePoint form library to retrieve the name of a user that was entered into a people picker control on the InfoPath form, and use this user to lookup a manager, and then perform a second lookup to find the manager of the manager of the user.

The SharePoint Designer 2010 workflow reads data from the InfoPath form and then uses it to create a new SharePoint list item.

The technique used in the video below is suitable for scenarios where the user who is filling out the InfoPath form does not require the manager of the manager to be immediately retrieved and displayed at runtime, but rather the manager of the manager can be retrieved later after the form is saved or submitted to the SharePoint form library.

If users require immediate feedback, you must make use of a different technique that involves using the User Profile Service as discussed in recipe 68 of InfoPath 2010 Cookbook 2 to retrieve data.

In this InfoPath 2010 tutorial video, you learned...

  • Add a Lookup Manager of a User action to a SharePoint Designer workflow.
  • How to retrieve data stored in a workflow variable.
  • Add a Condition to a SharePoint Designer workflow.
  • Add a Create List Item action to a SharePoint Designer workflow.
  • How to configure a SharePoint Designer workflow to run when an InfoPath form is either saved or submitted to a SharePoint form library.
  • How to publish a SharePoint Designer workflow to SharePoint 2010.
  • How to test a SharePoint Designer workflow that runs on an InfoPath form in SharePoint 2010.

InfoPath 2010 video tutorial transcript

Here I'm in InfoPath Designer 2010, where I've already pre-created an InfoPath form template that has a text box control on it, and a people picker control.

Basically, this is a form template that I'm reusing from a previous video that I created. The only difference with that form template is that I've added this person/group picker control to it, and also when I published the InfoPath form template to SharePoint, I promoted this AccountId field from the person/group picker control.

So if I switch to SharePoint, you'll see that this is the form library that I've published the InfoPath form template to, and it has an extra column called Account Id here, which comes from the promoted field.

The basic idea now is that I want to create a SharePoint Designer 2010 workflow that will run on any InfoPath form that I submit or save to this SharePoint form library, and what that SharePoint Designer workflow should do is it should retrieve whatever I entered in that person/group picker control and look for the manager of the manager of that user and then use the name of the manager of the manager to create a SharePoint list item in this MyList SharePoint list, which as you can see is currently empty.

So I'll switch to SharePoint Designer 2010. Here I've already pre-created a workflow. It's just a simple list workflow that runs on that SharePoint form library, and as you can see it doesn't contain any actions. So the first step would be to add an action that can retrieve the manager of the user that I entered into the InfoPath form.

And for that I'll use a relational action called Lookup Manager of a User. Then I'll click this user, and then I'll perform a lookup in the Current Item, which is the InfoPath form that the workflow would be running on, and I'll select the Account Id field, which is the promoted field of the person/group picker control.

That result will be stored now in this variable called manager and now the second step would be to find the manager of the manager, so I'd have to use another Lookup Manager of User action, and then this time I'll try to find the manager that is stored in the manager variable, so I'll select Workflow Variables and Parameters, and then select the manager variable.

And then that result, so the manager of the manager, will be stored in this manager1 variable. So now I've got the manager of the manager, but it could be that a manager doesn't have a manager, so basically what I'm going to do is I'm going to a check here, a condition that checks whether the manager1 variable contains a value, so if it is not empty what I want to do if it is not empty is create a SharePoint list item.

So then I'll add an action that creates a list item in the MyList SharePoint list. And then I'll set the title to be equal to the value that is stored in the manager1 variable, which is the manager of the manager.

And this is all I should require to be able to find the manager of the manager of a user. So now I'll just set the workflow to start automatically when an item is created, and then I'll publish it to SharePoint.

So now that the workflow has been published to SharePoint, I'll go ahead and test it. So I'll switch back to SharePoint. And first I'll show you which user I'll be using. I'll be using Jane Doe here. And as you can see this is Organization Chart here. Jane Doe has John Doe as her manager, and John Doe has Clovis Carvalho as his manager. So if I enter Jane Doe, I should find Clovis Carvalho as the manager of the manager.

So I'll just click Add document to add a new form. And I'll enter Jane Doe here and look up jane.doe. And then I'll save the form back to the SharePoint form library. And then the workflow should kick off. As you can see here it is in progress. So I'll refresh and continue waiting until it is completed. As you can see here it has completed. So what I'll do now is I'll go to the MyList SharePoint list, and then as you can see here, clovis.carvalho was found to be the manager of the manager of Jane Doe.

See more InfoPath 2010 tutorial videos »

 


Related InfoPath Articles:

 

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.

InfoPath 2013 Cookbook: 121 Codeless Recipes for Beginners

InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013

InfoPath 2010 Cookbook: 101 Codeless Recipes for Beginners

InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010

InfoPath 2010 Cookbook 3: 101 Code Recipes for C# Developers

InfoPath 2010 Cookbook 4: 101 Code Recipes for VB Developers

InfoPath 2010 Cookbook 5: Integrating InfoPath with Excel and Excel Services