In this post we will discuss how to get manager details of the logged in user in InfoPath 2013. Here we will retrieve manager preferred name instead of just manager account name. Also check out:
Here we will retrieve 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.
You can check out this article
to get manager account id of the logged in user 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 managers full name – mine was usersMgrName.
For the Value fieldwe need to get the PreferredName data based on the selected managerm 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 cannot expand no more…
– select the Value field under the ValueData directory – then click Filter Data.
– click the Add button – then in Specifiy 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 the far right drop down box in Specifiy 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.