This post will explain how to create a cascading dropdown within InfoPath 2010 for a list content type.
Example Situation: I am going to create a contact form which will filter the territories based upon the region of the form and then when I select the territory it will filter my store numbers to only show that territory’s stores.
→ Store Numbers
SharePoint 2010 List Which Utilizes a Two Lookups
A SharePoint 2010 Content Type
First we will need to navigate to the list:
1. Open Your List
2. Select List Tools
a. Select List
3. Select List Settings
4. Select Form Settings Under General
5. Select Your Content Type
6. Select “Customize the current form using Microsoft Infopath”
This will open InfoPath with that content type’s fields. We are modifying the form for this specific content type; we are not modifying the list form.
The next step is to create and style the form to meet your needs, for this example I created this from.
My form currently is displaying all of Mountain Store ID’s when in reality I only want the ID’s shown for that specific territory.
To create the cascading dropdown:
1. Right click your child lookup field and select “Dropdown List box Properties…”
2. The next step is to select Add… We will be creating a new data source in order to implement our cascading dropdown
6. Your URL for the site should be selected in the next screen
7. Select the child list which your lookup pulls from. In my example, my Mountain Store ID comes from my Mountain Region list.
8. Step 9 is really what makes this entire thing work. The default data connection only pulls the Mountain Store ID (aka Title) in the source list. The new data connection will allow us to query the list to obtain additional data. For our example I will be selecting Title & Territory since I will want to filter my ID’s down by the Territory.9.
10. Select Next
11. Select Next
12. In step 13, make sure to DESELECT Automatically retrieve data when the form is opened.
14. Select Finish
15. Now that we have created the new data source, we need to switch the value to ID otherwise we will run into validation errors later.
17. Select OK
Now that the new data source has been created, we can use it to create our cascading dropdown!
1. Select your parent field, in my case this field is territories. (All of my store ID’s are tagged with the Territory they correspond with in the Mountain Region List)
2. Select the Home Tab
3. Select manage rules
4. Select add rule
5. Select New
6. Select Action
7. Within your rule, select Add “Set a fields value”
a. We are going to set our Mountain Store ID to default to blank
8. Create another Set Field Value Action. In this action we will be setting our form to filter our Mountain Store ID’s based upon the territory.
9. We are going to set this action to set our Territory to our newly created Data Sources Territory.
10. Select the fields icon next to the Field: dialog box
11. A similar menu should appear like the one below:
13. Select the dropdown arrow and select the data source you just created. In my example, it
14. is Mountain Region1
b. Open Query Fields
c. Open q:SharePointListItem_RW
d. Select the field which corresponds with your parent field. In my example, it is Territory
e. Select OK
15. We now need to set the value for the second parameter of the Rule Details. Select the fx button and select your parent field from the main data source.
18. Select OK for all of the dialog boxes after you have selected your parent field from the main data source for the Value: input.
The last step to make this work is to query for data within the rule. So once again, lets select Add Action, just like we did to set the ID initially to blank and to set the Territory = Territory.
1. Select Add next to Run these actions
2. Select Query for Data
3. Select the Data source you created earlier from the dropdown box.