Advent Calendar Door 21: Creating cascading lookups in SharePoint
Creating cascading lookups in SharePoint
What is a cascading lookup in SharePoint terminology? Simply, it’s a lookup which will be filtered dynamically by any other value, including the value of another field in the same form. A classic here is Country/State lookup: based on selected value in the dropdown “Countries”, different states/regions should be dynamically shown in the “Regions” dropdown.
Of course, the “Regions” lookup field needs to have a property which is matching to the value we are filtering on. In this case, our “Regions” List has a lookup field “Country”, where the related country is referenced.
The next we need to do is to open the “Filter” behavior in the “Behaviors” tab of the field which you want to filter, in our case the “Region” field, and to set the filter itself.
Not that the field could be filtered by a fixed value, by a skybow Expression (you could do any kind of weird filtering here – for examples users from one SharePoint group might see different drop-down values than users in another SharePoint group), or, as in our case, based on the value of the other field in the same form – on our case, the “Country” field.
When you save this, and run the form, you will notice how available values of the “Region” field are changing based on the selected value of the “Country” field.
You could even make this form even more dynamic, and set the “Region” field invisible unless the “Country” field is selected, and then, if it visible, you could make it a required field, and filter it based on the “Country” selection, as shown here.
And all this was achieved in less than a minute. Because skybow. :)