How to Dynamically Enable/Disable Dependent Picklists

Overview

In this tutorial, you'll learn how to make a dropdown menu (combobox) inactive until you make a choice in another related Avonni Combobox.

Imagine you're selecting a car. First, you choose the brand (like Ford or Toyota). Only after you pick a brand do we want the model dropdown (like Mustang or Camry) to become active.

We'll use a simple true/false formula to check if the first dropdown has a value. This formula will control whether the second dropdown is enabled or disabled. This way, you can't pick a car model before choosing the brand, making the process more logical and user-friendly.

Guided Steps

Step 1: Create a Formula to Check if the Car Brand is Selected

  • Create a Variable: In your Flow, create a new resource. Choose "Formula" as the type and give it a descriptive name like "IsCarBrandSelected". Set the data type to "Boolean" (meaning it will be either True or False).

  • Write the Formula: Enter the following formula:

    ISBLANK({!carMaker.value})
    • {!carMaker.value}: This refers to the actual value the user has selected in the "carMaker" combobox within your Flow.

  • How it Works:

    • ISBLANK(): This function checks if the value inside it is empty (blank).

    • The formula returns true (True) if the carMaker combobox is empty (meaning no car brand has been selected).

    • The formula returns false (False) if the carMaker combobox has a value selected

Step 2: Dynamically Disable the Car Model Combobox

  • Locate the Car Model Combobox: In your Flow Builder canvas, find the Avonni Combobox element that represents the "Car Model" selection.

  • Edit the "Disabled" Attribute: In the properties panel, look for the "Disabled" attribute. It's a toogle.

  • Mapped the Formula: Instead of a fixed value (like True or False), click on the function button to select the boolean formula created in step 1.

By following these two steps, you've successfully implemented a user-friendly and intuitive experience for selecting car brands and models within your Salesforce Flow. The dynamic nature of this solution ensures that the "Car Model" picklist is only available when a "Car Brand" is chosen, guiding users seamlessly through the selection process.

This simple yet powerful technique can be applied to various scenarios where you have dependent picklists or fields in your Salesforce Flows. By leveraging formulas and visibility settings, you can create dynamic interactions that simplify data entry and reduce user errors.

Last updated