How to get Common Manager personal data – InfoPath2010

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:

    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.

     

    Filter settings:

    The result:

 

 

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.

     

    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

  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.

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

  12. Save this action.
  13. Add a new action: Query for data

     

  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:

The result:



Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>