0

Infopath 2013 form for Sharepoint online in office 365. I'm using User Information List data connection to get user's data. I need to retrieve user's manager data. How can I do that? Maybe there's another way to get user's information, with Azure Active Directory or something else?

0

Step 1 – Create the second data connection

Create the second Data Connection to user profile service

Click the Data tab from the ribbon, then choose Data Connection. the Data Connections dialog box appears and select “Add” Create a new connection to: Receive Data – Next > Where we want to recieve the data from: SOAP Web service Enter the location http://yourserver.com/_vti_bin/UserProfileService.asmx?WSDL – Next > Select an operation “GetUserProfileByName” – Next > and Next again > and Next again (make sure “store a copy of the data in the form template” is deselected) Give the data connection a name – I called mine “Get User Manager Details” (note: also make that “Automatically retrieve data when form is opened” is not selected) then Finish. The second data connection is done and now can be used to retrieve the managers information.

Step 2 – the mgrAccountName field

  1. create a field in the Main Fields – under myFields – call it mgrAccountName. Right clcik myFields and select Add – to add the field

  2. add a Default Value to the mgrAccountName field – using the first data connection (mine is “GetUserProfileByName” – to do this:

– open the Field or Group properties for the mgrAccountName field and click the Fx button to the right of the Value field. – the Insert Formula dialog box opens – select Insert Field or Group….. – select the drop-down box under Fields – where Main is currently selected and choose GetUserProfileByName – then click the plus (+) next to dataFields and keep clicking on the (+) symbols until there are no (+) symbols left to open and you see the Value field. – Select the Value field and click the Filter Data… button – When the Filter Data box opens, click Add – the Specifiy Filter Conditions opens – starting from the left – click the drop-down box and change Value to “Select a field or group” – when the Select a Field or Group box opens select Name – then click OK – Name needs to be “is equal to” Manager. – click the last drop-down box on the RHS and select Type text…. and type Manager. Click OK again and again until all boxes are closed.

the end result will be a Default Value of: Value[Name = “Manager”] for the mgrAccountName field.

And the filed will default to be the Managers account name of the logged on user.

  1. Next we need to add an action to the mgrAccountName – this will set the field value for the “Get User Manager Details” data connection to its (mgrAccountName) value – mmmm… just follow and watch

– Select the mgrAccountName field in Main Fields and right click and select Rules. – Select the New button from Rules to create a new rule for the mgrAccountName field, then choose Action – the Action is “set fields value” – so click on the Add button in Rules then “set field value”. – Field: click the button to the right and choose the field from “Get Users Manager Details” data connection. – under myFields click the (+) symbol next to queryFields – then one more time under for the next folder – you should now see AccountName – select this and click OK – Value: click the Fx button to the right – then click Insert Field or Group – from the Main Fields choose the current field (mgrAccountName) – click OK – close all the open boxes.

Step 3. the Managers Full Name field

  1. create a new field (if you don’t already have one) to the Main Fields – I named mine 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.

  • I've read this article already and it's not working since Microsoft disabled access to the User Profile service. – notChosen Nov 30 '17 at 3:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.