SharePoint’s “Subindustries” list has two fields – “Title” and “Industry,” which is itself a lookup field to the “Industries” list. It makes sense in the “Leads” form to make those two fields dependent: after a user selects an industry, only those values that belong to the corresponding industry will be shown in the “Subindustry” field. For example, if the user chooses the “Information Technologies” industry, the only choices that should be presented for the “Subindustry” field should be “Semiconductors,” “Software,” and “Hardware.” This is called “cascading lookup fields,” and it is not possible in SharePoint without heavy customizing. With skybow Solution Accelerators, it is achievable within seconds.
To achieve this, we need to put the filter on our “Subindustries” lookup field in the skybow Solution Studio. This filter is in the form of a CAML query, and defines the fields of the “Subindustries” list that the lookup will be filtered by (in our case it is the “Industry” field of the “Subindustries” list), and which value that field should have (in our case the value of the “Industry” field of the lead that we are adding or editing).
We will open the “Lookup settings” of the “Subindustry” field, and click on the query icon beside the “Query for Lookup” field. That opens the visual CAML query builder:
Creating cascading lookups through setting the lookup queries
In the CAML Query Builder popup window, we will set the Where clause as the “Industry” field of the “Subindustries” list, set to the value of the “Industry” field of the current “Leads” item (use the [[Industry.ID]] placeholder from the skybow expression engine to achieve this).
Press the “OK” button, and the resulting CAML query will be:
<Where><Eq><FieldRef Name='Industry' LookupId='True' /><Value Type='Lookup' >[[Industry.ID]]</Value></Eq></Where>
When we save the changes, we will see that the “Subindustry” lookup field behaves exactly as it should – as a field dependent on the “Industry” field:
Behavior of cascading Industry-Subindustry lookups
In this way, within seconds, we have met the customer’s requirement for cascading lookup fields in SharePoint forms.