Share via


Sharepoint 2013: Get User by Jobtitle to use in InfoPath Forms

This can be achieved either value selected into people picker control or it can be done on button control or text box value change event on InfoPath form.

Using, People picker value control, so once the user inserted email ID into people picker ,I am going to display the job title on Textbox control. 

Steps

Open InfoPath form and create New Manage data connection.

 Give your SharePoint site address . http://<Your Web App>/_vti_bin/UserProfileService.asmx,

  Click on GetUserProfileByName and click Next.

  Select AccountName

 Uncheck Automatically retrieve option and Finish. New data connection is  ready use.

  Go back to your InfoPath form and drag People picker control and text box. I am going get the JobTitle of Manager and display over the textbox. I renamed the textbox as ShowJobTitle. 

  Click on textbox and go to manage rule.Create New Action and select set a field value. For Field select AccountName from your new data connection.
    

  Select the value as AccountId of the people picker user control from Main.
  

  In the InfoPath form, add another “action” rule to the same control. This time select “Query for data” and select the new data connection(GetUserProfilebyName) Web services created.

  Again create New Action and select set a field value. Select from Main and set textbox(ShowJobTitle) as fields.

  Click fx next to value and Click “Insert Field or Group…” button and Switch to the Web service created earlier and select the “Value” property from below, and click the Filter Data button.

  Click add button and select "Select field and Group" ,switch to new data connection and select "Name" Property.Select “Type text…” and enter "Title"

https://social.msdn.microsoft.com/Forums/getfile/1042444

  We are good to go now.

https://social.msdn.microsoft.com/Forums/getfile/1042448