Get Manager Details for Logged in User in InfoPath in SharePoint

This InfoPath SharePoint 2013 tutorial explains, how to get manager details of the logged-in user in InfoPath 2013 in SharePoint 2013/2016 or SharePoint Online. Here we will retrieve manager preferred name instead of just a manager account name in InfoPath 2013.

Here we will retrieve the manager’s preferred name, If you want to retrieve only manager account id then only one user profile connection is required. But in our case, we need to use 2 data connections to get manager preferred name.

In one data connection, we will retrieve manager account id based on the logged in user and in other data connection we will retrieve the manager preferred name.

Once you have the above thing ready, Create another data connection name as “Get Users Manager Details” and here set the manager account Id to a variable. You can check this article to know more about how to create a variable.

Now we will use our 2nd data connection to Get Users Manager Details:

1. Create a new field to the Main Fields name as usersMgrName.

2. In the Fields tools change Main to “Get Users Manager Details”

Expand the queryFields by clicking the (+) symbol –> then do this to the next folder until you can see the AccountName field –> select this field.

While AccountName field is selected –> click on the Home tab on the ribbon –> then click Manage Rules to Add a new rule to the AccountName field. Click New –> to create the new rule.

We are going to create two actions, one to query the data connection and the other to set the usersMgrName field.

Action 1: Select Add –> and select “Query for data” –> make sure in the Rule Details, the Data connection is “Get Users Manager Details” is selected – click OK.

Action 2: Select Add –> and then “Set a field’s value” –> in the Field select the new field you created for the manager’s full name –> mine was usersMgrName.

For the Value field, we need to get the PreferredName data based on the selected manager to do this –> click on the Fx button to the right…. the Insert Formula box appears.

Click on Insert Fields or Group –> then select the “Get Users Manager Details” connection from the list of Fields –> expand dataFields all the way until you can expand no more…

Select the Value field under the ValueData directory –> then click Filter Data.

Click the Add button –> then Specifying Filter Conditions, click the first drop-down box on the left and choose “Select a field or group…”

Select Name from “Get Users Manager Details” connection data source – click OK

On the far right drop down box in Specify Filter Conditions select “Type text..” and type PreferredName –> click OK –> then OK –> then OK

You should now see the Formula –> Value[Name = “PreferredName”] –> click OK to finish –> then OK one more time.

Similarly, if you want to retrieve manager work email, phone etc we need to follow the same steps.

You may like following InfoPath SharePoint tutorials:

Hope this will be helpful to retrieve Manager Details for Logged in User in InfoPath 2013/2010 in SharePoint 2013/Online.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.