How to auto-populate user information by people picker in multiple sections in InfoPath form
Introduction
Purpose
This document will step a technician to how to auto-populate user information by people picker in multiple sections.
Scope
To be used by support technicians to how to auto-populate user information by people picker in multiple sections of Infopath form.
Prerequisites
Need access of site collection administrator or designer.
Need to install MS Office InfoPath 2010.
Need to enable “SharePoint Server Enterprise Site Collection features”.
Need to Identify, how many time you need to auto populate user information.
Overview
Before creating this InfoPath form, user must be aware of the all columns and fields information.
Steps
Step 1.1 Open a Microsoft InfoPath Designer 2010
Step 1.2 Create a New blank form,
Go to File and click on “New”, then choose “Blank form” in Available Form Templates.
Step 1.3 Add a connection to the UserProfileService.
1. Click on Tools > Data Connections > Create a new connection. Select “Receive data”, click Next.
2. Select “Web Service” and click “Next”.
3. Enter UserProfileService URL (enter your server name here):
http://SERVERNAME/_vti_bin/userprofileservice.asmx
click Next
4. Select “GetUserProfileByName” method and click Next.
5. At the next screen, leave default values intact and click Next.
6. At the next screen, leave default values intact and click Next.
7. Enter a name for this data connection, for example “GetOTHERuserProfileByName”.
Make sure to UNCHECK “Automatically retrieve data when form is opened” checkbox. Click Finish.
Step 1.4 Create Sections in InfoPath form as per your requirement.
(Note: If you need to populate data for multiple users you need to create multiple sections).
Go to the Controls in Home tab and select Sections in container
(Note: For this security request form you need to create three different sections).
Give appropriate name in the properties to the section like Section A, Section B and Section C.
Step 1.5 Create following columns with following properties:-
You have chosen “Blank form” now you need to create table by using of and create 2 rows and 2 columns.
Click on OK
Now you form will look like this.
MyFields is bydefoult first section
We created two more sections and given them following names. SectionB ans SectionC
Click here to add Title: Ex (Security Request Form)
Step 1.6: Add the control to the form.
1. Drag and drop the control to the desired location on the form.
2. Go to the Data Source task panel.
3. Modify the data source so that the group that is created by the new control is exactly like the data source pictured. The “Person” group is a repeating group, the field names are case sensitive and must be exactly as shown below.
The control on the form that can be used to lookup users in Active Directory. Which is pretty nice if the DisplayName and Account ID are all the information that is needed? Here’s how to get more:
Step 1.7 Publish this farm to the SharePoint Farm library.
1. Click on File, and then Publish button
2. Click on SharePoint Server farm
3. Save this farm and give appropriate name.
4. Then SharePoint Site collection URL Ex (http://WebApplicationName/site/<sitename>
5. Click on Next
6. You will get the publishing Wizard and Checked the “Enable this form to be filled out by using a browser”. Click Next.
7. Select create a “new form library”
8. Give name to the Farm library and then click next.
9. Click on next and then click on Publish
10. Then “Close”
Step 1.8 Add your rules.
1. While in the Data Source task pane, create a field in the main data source (but not in your Contact Selector group) and name it something meaningful. I use HiddenAccountName to keep it distinct from the field in the Contact Selector group.
2. Click the drop-down menu on your data field in the data source, click “Properties”, and then click the function button to set the default data.
3. Click “Insert Field or Group…”
4. Select the AccountId field from your contact selector group, then click OK on each window until the Field or Group Properties is showing(2 times).
5. Click the Rules and Merge tab, click Add.
6. Don’t set any conditions, this rule always applies, click Add Action.
7. Select “Set a field’s value” from the drop down.
8. Click the data source button next to the “Field” field.
9. Select the data source you wish to use for the lookup in the drop-down menu. *Be sure you don’t re-use the connection for the current user data if you have one in this form.
10. Expand the query fields and sub-groups, then select “Account Name”, click OK.
11. Click the function button next to the “Value” field, and then click Insert Field or Group.
12. Select the current field you created in step 1 above, click OK until all windows are closed (3 times).
13. In the data source pane, use the drop-down menu to select the data source that you will use to look up another user’s profile information.
14. Expand the query fields and all sub groups until the field AccountName is visible. Click the drop-down menu on the AccountName field, then click properties.
15. Click on the Rules and Merge tab, then click Add.
16. Do not set any conditions, this rule will always apply. Click Add Action.
17. Select “Query using a data connection” from the drop-down menu.
18. Select the data connection you wish to use for the lookup from the drop-down menu (it should be the same as the data source listed in the task pane), then click OK.
19. Click Add Action.
20. Select “Set a field’s value” from the drop-down.
21. Click on the data source button next to the “Field” field.
22. Ensure you change the data source to “Main” and select the field you wish to auto-populate, then click OK.
23. Select the function button next to the “Value” field, and then click Insert Field or Group.
24. Expand the data fields group and all sub-groups, select “Value”, click Filter Data, and then click Add.
25. Where the “Value” field is defaulted, click the drop-down and select “Select a field or group…”
26. Select the “Name” field under “Property Values”, click OK.
27. In the third field, click the drop-down and select “Type Text”.
28. Type the property from the user profile that you wish to enter in the field, and then click OK until you are back to the “Rule” window (5 times).
You can follow this image for setting the properties.
Repeat steps 19 through 28 for all fields that you wish to have auto-populate with the other user’s data. It is important that “Query using a data connection” remain the first action. If it is not the first action, highlight that action and move it up until it is the first.
29. Click OK on all windows until you are back to your form.
Now you have a contact selector that allows a user to look up another user in AD and have their profile properties auto-populate fields on the form.
(NOTE: If you have multiple sections you need to follow step 1 to 12 in all the sections)