What's the best way to have a dropdown with 10+ options that filters a repeating group?

I’m just wondering the best way to tackle this as I feel like I’m reinventing the wheel here. I have a list of opportunities as a repeating group. I then have a dropdown with multiple options that should filter that repeating group. So for example

Option A - (Filter list to records owned by current user, with stage being A or B)
Option B - (Filter list to records owned by current user, with stage being C)
Option C - (Filter list to all records, with stage being A or B)

And so on, but think 10-15 dropdown options with different criteria like that. The way I was doing it right now is with a workflow for each option which is super clunky, like:

  • When dropdown value changes and current value = Option A, then display repeating group where owner = current user, etc.

I’m just finding that it’s getting hard to track, as that’s a lot of workflows and options. I can make it work, but wondering if there’s a better way to do something like this.

Have you considered using conditionals on your rg?

Condition 1
If dropdown's value = "Option A"

Then
Data Source: Do a search for Opportunities:filtered

Filter
owned by: current user
advanced: this Opportunity's stage = A or this Opportunity's stage = B



Condition 2
If dropdown's value = "Option B"

Then
Data Source: Do a search for Opportunities:filtered

Filter
owned by: current user
stage: C



Condition 3
If dropdown's value = "Option C"

Then
Data Source: Do a search for Opportunities:filtered

Filter
advanced: this Opportunity's stage = A or this Opportunity's stage = B



Optimizing performance
You can restructure how you load search results to speed up the load speed as well.

Option 1- Load all of your unfiltered opportunity results into a page state i.e. list of opportunities on page load. You can then reference and filter it on your conditionals.

Option 2 - you can also load all of your unfiltered opportunitys into another hidden repeating group. You then reference that hidden repeating group’s list of opportunitys in your visible repeating group and apply the filters

Why? Speed. Both options above query the DB on page load and wont query it again after each time you change your dropdown and re-filter the results (thus changing your visible RG conditional and therefore its data source). The result is a faster search experience. :slight_smile:

Option 1 you need to load that state with your list of opportunitys on page load. That list wont change until the page reloads.
Option 2 will query the db automatically on page load. It will also keep up to date if new data is added to the search query after the page is loaded.

4 Likes