<img height="1" width="1" src="https://www.facebook.com/tr?id=730305433807073&amp;ev=PageView &amp;noscript=1">
Book a Demo

Dynamic Forms - Part 5: Making values in the “Subindustry” field dependent on the “Industry”


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.


You want to read the whole story? Click here to get the eBook!

Rich Forms eBook

Adis Jugo

Written by Adis Jugo

is Director of Product Technology at skybow, and a software architect with over 20 years of experience. Adis is double Microsoft MVP (Most Valuable Professional) for Office Development and for Office Servers and Services. He first met SharePoint (and Microsoft CMS server) back in 2002, and since 2006 his focus was completely shifted towards architecture and development of productivity solutions, now based on the Azure, Office 365 and SharePoint technologies. Adis is an internationally recognized speaker with over 15 years of speaker experience, speaking at various Microsoft, Community and SharePoint/Office 365/Azure conferences worldwide.