Loading
Salesforce now sends email only from verified domains. Read More
Help Agent Performance DegradationRead More
Agentforce Contact Center
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Use Case: Use If Condition to Show Content Based on Complex Logic

          Use Case: Use If Condition to Show Content Based on Complex Logic

          Use the If Condition screen element to dynamically show content or screens. For example, you can use the If Condition to add a footer that navigates to a different screen based on the previous selection. With the If Condition screen element, Salesforce evaluates one or more conditions in sequence and displays the content if the condition evaluates to true. If the condition is false, the logic returns the other preconfigured content. Unlike the Switch conditional logic, If Condition logic supports complex criteria by combining conditions using AND and OR logical operators.

          Required Editions

          View supported editions.
          Checkmark This article applies to: Enhanced WhatsApp channels, Unified WhatsApp
          X icon This article doesn’t apply to: Enhanced In-App Chat, Enhanced Web Chat, Standard and Enhanced Facebook Messenger, Standard and Enhanced SMS, Enhanced Apple Messages for Business, Enhanced LINE, and Bring Your Own Channel
          User Permissions Needed
          To create messaging components:

          Customize Application AND View Setup and Configuration

          OR

          System Administrator

          To send and receive messages in Messaging: Messaging Agent

          To illustrate how to use the If Condition screen element, consider this example. You are the Salesforce admin for Healthy Pets, a veterinary hospital. Your job is to update the last screen of a WhatsApp Flow to include a summary of the scheduled veterinary appointment.

          The summary must follow this format:

          Dr. <doctor_name> looks forward to seeing your <animal_type> for a <visit_type> visit. If you have any questions, feel free to reach out to us.

          Use an If Condition to display a different message based on the type of visit (in-person or video call) and animal type. Dr. Catalina handles in-person visits for cats only. Dr. Virtuoloso handles all other visits, virtual or in person, for any other type of animal.

          This example assumes that you already created a form messaging component based on an Apex class and created a Flow format.

          1. Open the Form messaging component.
          2. In the left sidebar, under the Component Formats section, select Flow.
          3. In the Screens section, expand the screen where you want to add the summary.
          4. In the Component Properties section, click Add Content.
          5. Expand Conditional Logic, select If Condition, and click Done.
          6. Add the condition.
            1. Add another condition that checks if the animal type is Cat.
            2. Add the condition that checks if the visit type is In-Person.
            3. Because both conditions must be true to assign Dr. Catalina to the appointment, in the Condition Logic field, select All Conditions Are Met.
              Conditional logic with two conditions.
            4. Click Next.
          7. Define the content to show when the condition logic is true or false.
            1. In the Content for True Conditional Logic screen, click Add Content, and add the content.
              Shows the results when the condition is true.
            2. Click Next.
            3. In the Content for False Conditional Logic, click Add Content, and add the content.
              Shows the results when the condition is true.
            4. Click Save.
            5. Save the messaging component.
           
          Loading
          Salesforce Help | Article