Solved

Using database fields in InfoPath

Posted on 2009-05-15
3
677 Views
Last Modified: 2012-05-07
I have an InfoPath form with a data connection to a Sharepoint list. One field (UserName) allows the user to select their name from a Sharepoint list field. I have a few other text fields.and would like their default values to pull their data from the Sharepoint list record selected. For example, the user's address, phone number etc. The user could then modify their contact information as needed.

How do you have the text fields reference the values in the SP list of the record selected in the UserName field?
0
Comment
Question by:Omer Maor
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Greg Burns earned 250 total points
ID: 24406015
I did something similar to this once. I had a dropdown list that pulled a list of names from a SharePoint site; when a user selected a name, that person's phone number and email were displayed in two other fields. Here is how I did it:
Add fields to the form:
  1. Add a combo box. This will contain the dynamic list of names to be used. Give this control a meaningful name, as it will be referenced by other fields on the form. I named mine "NameOfRequestor"
  2. Add two text boxes and make them read only. these will display the Phone and Email addresses. Since they are lookup values, I didn't want the user to change them. I named these fields "RequestorPhone" and "RequestorEmail".
Add a data connection:
  1. Go to Data Sources and add a new connection to Receive Data.
  2. Select SharePoint Library or List
  3. Enter the URL of the site you're receiving data from.
  4. Select the list / library.
  5. Specify the columns you want to include in your resultset (In my case, it was Full Name, Phone, and Email)
  6. You can optionally choose to save a copy of the downloaded results in the form template, so that it will contain a snapshot of list items that will be available when the form is filled out offline.
  7. Provide a name for the data connection (I named mine "Requestors") and click Finish.

Click on Properties to Bind the Data Connection to the Combo Box.
  1. Under Llist box entries, select "Look up values from an external source"
  2. Select the data source you created above.
  3. In the "Entries" field, click the Browse button and drill down to MyFields-->dataFields-->(Your data connection). Click OK.
  4. The "Value" and "Display Name" fields will suggest a field to be used, If it is not the right one, browse to the correct fields. In my case it was @Full_Name.
Set up a Rule to update other fields when this field is updated.
  1. In the Combo Box properties, click the "Rules" button. Add a new rule.
  2. Do not set a condition (this rule always applies).
  3. Add an action to update the RequestorPhone text box.
  • Action: "Set a field's value".
  • Field: This part is a little tricky. You want to update the text box, so be sure the "Data source" is set to "Main". Drill down to the "RequestorPhone " field and click OK.
  • Value: Click the formula button.
    • Click the Insert Field or Group button and select the Requestors Data source you added above.
    • Drill down to the "MyFields-->dataFields-->Requestors" and select the field for "Business_Phone" (this is the name of the field in my SharePoint list).
    • Click the Filter Data button.
      • Add a filter for when "Full_Name" "is equal to" and in the criteria field, click "Select Field or Group". In the "Main" data source, select the "NameOfRequestor" combo box.
      • Click OK.
      • Click OK.
    • The formula should read something like "@Business_Phone[@Full_Name = NameOfRequestor]".
    • Which translates to "Show me the [Business Phone] value from my data set where the [Full Name] value matches whatever value is in the Combo Box [NameOfRequestor].
  • You're not done!

    Now keep adding other actions and do the same thing for all other associated fields you want to update whenever the Combo Box is updated.   They will all trigger at once and display associated information.
hope that helps!
0
 

Author Comment

by:Omer Maor
ID: 24423487
Thanks for such a tremendously detailed response. I'll check it out and let you know how it went.
Sam
0
 

Author Closing Comment

by:Omer Maor
ID: 31582094
Perfect - worked like a charm. Thanks.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sharepoint to FTP? 3 61
How to renew SSL certificate on Sharepoint 2013 server. 6 141
Set cookies HttpOnly and Secure 4 107
VBA in SharePoint 3 38
Work Over Net is a new and very powerful collaboration product. With its new easy interface it is becoming very competitive to other similar products like webex and office interactive. WON 2010 have the standard business tools needed for multi-offic…
Last week I faced a strange issue recently, i have deployed SharePoint 2003 servers for one project and one of the requirements was to open SharePoint site from same server. when i was trying to open site from the same server i was getting authentic…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now