---
schema_version: "1"
id: 425c0d4e64d2df4982caaad639ea80171303b4089f51e917f4779ab0c05a92a8
title: "Use Case: Use If Condition to Show Content Based on Complex Logic"
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/service/264-0-0/messaging_dynamic_whatsapp_flow_if_element.md
canonical_url: https://help.salesforce.com/s/articleView?id=service.messaging_dynamic_whatsapp_flow_if_element.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 62759aad0e2f10416457449d3c9e33a10f4c2bb86233d5068475338c040777a2
description: 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.
products:
  - Service Cloud
  - Digital Engagement
release: "264"
---
# 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

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <tbody>
          <tr class="">
            <td class="slds-cell-wrap" colspan="2" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=service.messaging_editions.htm&amp;language=en_US" target="_blank">View supported editions.</a></td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="vertical-align:top;">
              <a name="messaging_dynamic_whatsapp_flow_if_element__image_cgj_vgf_5cc"><!-- --></a><span style="vertical-align:text-bottom;display:inline-block;"><img style="margin-bottom:0;" id="messaging_dynamic_whatsapp_flow_if_element__image_cgj_vgf_5cc" src="https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-service-support_channels-264-0-0-production-enus/f3c4b3d2-ff86-4f7c-9fe2-3d8b23d35109/resources-global/_corporate/images/checkmark.png" alt="Checkmark"></span>
              <strong>This article applies to:</strong>
            </td>

            <td class="slds-cell-wrap" style="vertical-align:top;">Enhanced WhatsApp channels, Unified WhatsApp</td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="vertical-align:top;">
              <span style="vertical-align:text-bottom;display:inline-block;"><img style="margin-bottom:0;" src="https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-service-support_channels-264-0-0-production-enus/f3c4b3d2-ff86-4f7c-9fe2-3d8b23d35109/resources-global/_corporate/images/crossmark.png" alt="X icon"></span>
              <strong>This article doesn’t apply to:</strong>
            </td>

            <td class="slds-cell-wrap" style="vertical-align:top;">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</td>

          </tr>
        </tbody>
      </table> <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d46354e95">User Permissions
              Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d46354e95 ">To create messaging components: </td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d46354e95 ">
              <p>Customize Application AND View Setup and Configuration</p>
              <p>OR</p>
              <p style="margin-bottom:0;">System Administrator</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d46354e95 ">To send and receive messages in Messaging: </td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d46354e95 ">Messaging Agent</td>

          </tr>
        </tbody>
      </table>

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.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-service-support_channels-264-0-0-production-enus/f3c4b3d2-ff86-4f7c-9fe2-3d8b23d35109/support_channels/images/messaging/messaging_form_component_whatsapp_flow_if_conditions.png)
    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.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-service-support_channels-264-0-0-production-enus/f3c4b3d2-ff86-4f7c-9fe2-3d8b23d35109/support_channels/images/messaging/messaging_form_component_whatsapp_flow_if_condition_true_content.png)
    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.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-service-support_channels-264-0-0-production-enus/f3c4b3d2-ff86-4f7c-9fe2-3d8b23d35109/support_channels/images/messaging/messaging_form_component_whatsapp_flow_if_condition_false_content.png)
    4. Click **Save**.
    5. Save the messaging component.