In Creatio, or any system, a dependent lookup is a lookup that the choices are dependent on what’s selected in another lookup. Sometimes they are referred to as cascading lookups. The basic idea is one lookup filters the choices available based on what you pick in another lookup. This is common with things like type and sub-type. Another example of this would be the state and city lookup in Creatio, the city lookup depends on what is selected in the state lookup and will only show the cities for the selected state. The example in this article is going to be with a subcategory and category lookup. The end result will look like this.
First thing to do is make the subcategory and category as normal lookups, then go to the configuration and add a category lookup on the subcategory object. This will let us pick a category for each item we put on the subcategory lookup.
Now you’ll want to go to the lookups and find your subcategory lookup. Now there should be another column on there where you can connect your subcategories to a category. If you don’t see the category column then you can add it by going on the view menu and click setup columns and add it.
Last step is to add a business rule to do the filtering. This is going to be a normal filter business rule where we will filter the subcategory on the selected category. It will look something like this.
Now your two lookups should be filtering properly. Once a category is selected, you should only see the subcategories for that category.
There are two optional properties that you can add to the filter business rule in the page code that gives you more functionality. They are (note, these are case-sensitive):
- autoClean – this will clear out the subcategory if you change the category to something else after you already picked a subcategory.
- autocomplete – this will automatically choose the category if you pick a subcategory first.
Open the page code look for the business rule section and add them like this.