Skip Ribbon Commands
Skip to main content

See the Point



 Other Blogs



See the Point > Posts > Auto-Pop Life with InfoPath (Part 1 of 2)


July 22
Auto-Pop Life with InfoPath (Part 1 of 2)
Forms are everywhere. You would be hard pressed to find some sort of business process that doesn't involve the use of some form. Developing InfoPath forms can be done to make many processes electronic. Combine the power of InfoPath 2007 with SharePoint's InfoPath Services and you can really make some dynamic forms with workflows to automate complex business processes.
So, lets say you have designed an InfoPath form that is a request form. What do your users want you to do? Make the process faster! What is the easiest way to do that? Make as many fields auto-populate as possible. What InfoPath combined with SharePoint's User Profile Service does is allow you to populate user information with no code! This means that the end user doesn't have to enter their information when you already have it populated in Active Directory (AD).
To get the current user's information:
1. Open InfoPath 2007 and click Design a Form Template.
2. You can choose to design from a blank form, one you have already created, or customize a sample.
3. Click Tools>Data Connections, then click Add to add a new connection.
4. Ensure "Create a new connection to:" is selected and select the radio button next to "receive data" then click Next.
5. Web Service should be selected, that is what the User Profile Service is, then click Next.
6. Enter the following address for the web service: http://<your site here>/_vti_bin/UserProfileService.asmx then click Next.
7. A list of options for the data will be shown, scroll down and select GetUserProfileByName, click Next.
8. Do not change the parameters, click Next.
9. Do not check "Store a copy of the data in the form template", click Next.
10. Ensure "Automatically retrieve data when the form is opened" is checked. You can change the name of the connection if you desire. Then click Finish.
Now you have this data connection, but that is a lot of work, right? Let's make it easier for future forms. We can take this connection and convert it to a universal data connection and store it in a library within SharePoint to be used in other forms. Leave your Data Connections open, in your SharePoint site, create a Universal Data Connection Library. Site Actions>Create (or View All Site Content>Create), select Data Connection Library from the Libraries list, title it and set the navigation and versioning as preferred.
Now, back to InfoPath.
11. Ensure that the data connection you created is highlighted and click Convert.
12. Enter the URL of the library (or browse to it) and the filename of the connection. Make it meaningful to you and don't forget the .udcx file extension.
13. For most power users who may create forms, select the "Relative to site collection (recommended)" option, click OK. This means that any forms posted within that site collection can utilize this single data connection that has already been created.
You will need to go to the Data Connection Library and approve the connection before publishing your form. For future forms, you only need to create a new data connection, select "Search for connections on a Microsoft Office SharePoint Server". Select your site (or manage sites to add your site to the drop-down), expand the data connection library, select your connection and then continue through setting up the data connection.
Alright, now we have this data connection, how do we use it to auto-populate fields in the form?
1. Double-click on any text box (or add one to your form) to adjust the properties.
2. In the default value field, click on the function button.
3. Click "Insert Field or Group".
4. Select your data connection from the drop-down menu, click OK.
5. Expand the "data fields" and all sub-folders until you can select the "Value" field, then click "Filter Data".
6. Click "Add" to create a new filter.
7. Where the "Value" field is defaulted, click the drop-down and select "Select a field or group..."
8. Select the "Name" field under "Property Values", click OK.
9. In the third field, click the drop-down and select "Type Text".
10. Type the property from the user profile that you wish to enter in the field, then click OK until you are back at your form.
11. Repeat this process on all of the fields that you want to auto-populate.
Below are some of the more common properties that you can filter on to populate your form. This is not an exhaustive list, but you can look at the Profile Properties that are defined within your Shared Services Provider for more.
So, now you can have a request form that auto-populates data about the current logged in user who is completing the form. All without writing a single line of code! Stay tuned, tomorrow I will show you how you can take this data connection and combine it with another InfoPath control to auto-populate data for users other than the currently logged in user.
Comments Use SHIFT+ENTER to open the menu (new window).
Auto Populate
Great Information!!! Have already put it to use.

Populating Active Directory Information in InfoPath
Lori here is my situation.  I've created a form through InfoPath that is going to be published on SharePoint.  What I need to do is input an employee number in one field and then populate the employee name in another based off of the employee number entered on the first field from Active Directory.  I hope you can help as I have been struggling with this all day.
selected user group
Hi lori i was looking for active directory group for a selected user via contact selector but i'm using userprofilebyname and it keep returning the current user logged in active directory group . how can i correct it for my users ??
Auto Populate
I was able to populate the Username field but am stuck while populating the email id.....please confirm if I can use the same Web Service or some other one should be added if yes what is that.....Thank you!!
Browser enabled
I was going through your instruction and then I got stuck. I was not getting any filter data tab. I think because my form is browser enabled. Do we have another option to use this web service.
Works beautifully!
Thanks so much!
Thank You!
This is perfect!
infopath dropdown
hi help needed
I have a list which holds country value.This list is shown in a drop down.

I have another drop down for states.

When I select the country, the state drop down should be populated with the states of selected country.

I am new to info path and doesn't know how to achieve this.

is there any rules to set this????
auto-populate groups
I like the post on Auto-pop - this is great for individuals but what if I need to pull stuff from AD that is not specific to a person - for example, all the departments listed for the company.  So a person filling out a form can have a drop down of departments to pick from.  Same thing for things like Job Titles and similar.  Is there a group profile service that might do this?
Thank You!
great solution

 About Me


Lori Gowin
SharePoint Administrator

Lori is a SharePoint Administrator who has been working with SharePoint and InfoPath technologies for over 5 years. When not focusing on SharePoint, Lori unwinds watching sports and spending time with her husband and children.

Women in SharePoint