SPointBlog SPointBlog
How to get Common Manager personal data – InfoPath2010
7/29/2011 12:00:00 AM
SharePoint 2010;InfoPath

getCommonManager web service helps you to find the user common manager name but won’t allow you retrieve any personal information fields.

For this task we need to use another web service: getUserProfileByName.

We need to query this web service with manager AcountName to get the data. Sounds simple? It is!

Here is a step-by-step guide to help you through it:

 

Scenario: we have an InfoPath Form with 3 fields: Current User Name, Manager Name, Manager Phone Number. We need to populate data.

 

Current User Name:

  1. Create a new data connection. You need to receive data about your current user.
  2. Choose SOAP Web Service as a source and then type this URL into the text box:
    http://serverName/_vti_bin/UserProfileService.asmx?WSDL (change the serverName to yours).
  3. Choose GetUserProfileByName method. Do nothing else but clicking “Next” until you will need to give the name to your data source. Name it getUseProfile.
  4. Drag a new text box to your form. Set the default value of this text box this way:
    Enter the default value function window:

1.png

Click on “Insert Field or Group” -> Choose the data connection we just created -> choose the “Value” field from the tree -> Click “Filter Data” to get the right property for our user.

2.png

Filter settings:

3.png

4.png

5.png

The result:

 

6.png

Common Manager Account Name
  1. Create a new data connection. You need to receive data about your current user.
  2. Choose SOAP Web Service as a source and then type this URL into the text box:
    http://serverName/_vti_bin/UserProfileService.asmx?WSDL (change the serverName to yours).
  3. Choose GetCommonManager method. Do nothing else but clicking “Next” until you will need to give the name to your data source. Name it GetCommonManager.
  4. Drag a new text box to your form. Set the default value of this text box like so:
    Enter the default value function window and choose the “Name” field for the GetCommonManager data source.
7.png

  1. That’s it!
Common Manager Phone Number
  1. Add a new textbox names “Manage Phone”.
  2. To fill this field automatically we need to add a rule to the “Form Load” rules to trigger the filling.
  3. Delete the default value from the Manager Name field.
  4. Click the “Form Load” under the Data tab on the ribbon.
  5. Add a new action: Set field’s data. Set the Manager Name like we do in the previous part.
  6. Click on the Manage Name text box.
  7. Click “Manage Rules” on the Ribbon.
  8. Add a new “Action” Rule
8.png


 

9. Add a new action: Set field’s value.

10. In the field textbox choose the AcountName field from the queryFields of the getUserProfile data source.

9.png

11. In the value textbox choose your manager account name field.
10.png

12. Save this action.

13. Add a new action: Query for data

11.png

14. Save this action.

15. Add a new action: Set field’s data.

16. Put the WorkPhone of the manager to the Manager Phone field just like we do with preferred name of the current user.

 

The complete rule:
12.png

The result:
13.png


 

 

 Leave a comment

 
Name:
Comment:
RelatedPostID:

  
There are no items to show in this view of the "Comments" list. To add a new item, click "New".