---
schema_version: "1"
id: 051fcc4c081fcde23bd8cef5cf6f107ae8a361ecf7fd66e3eb9b69eefe78e8a0
title: Example of Invoking a Decision Explainer Enabled Expression Set from Flow
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/example_invoking_des_enabled_expression_set_from_flow.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.example_invoking_des_enabled_expression_set_from_flow.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 103b68a0e18113adf9bba7cb2bf2bb3ffe9e2db3defb8fee214c158723f19fc2
description: This example shows how to invoke an expression set that uses Decision Explainer from flow. The example also shows how to view every run of the expression set in the action logs for the context in which the expression set is run.
products:
  - Industry Solutions
  - Cross Cloud
release: "264"
---
# Example of Invoking a Decision Explainer Enabled Expression Set from Flow

This example shows how to invoke an expression set that uses Decision Explainer from flow. The example also shows how to view every run of the expression set in the action logs for the context in which the expression set is run.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions for Industries clouds that have Business Rules Engine and Decision Explainer enabled.</td></tr></tbody></table>

To promote fitness and well-being, a company is offering a discount on its annual gym membership to its contacts. To encourage physical movement, the company launched a week-long step challenge for its contacts. The annual membership price is $1,000. A discount is offered on this price based on a contact’s age and the step count from the week-long step challenge.

The company’s sales team gave the rule designer and the Salesforce admin the age and step count ranges and the applicable discount percentages. The company also asked that the discounted gym membership fees be updated on a contact’s record detail page for quick reference.

The rule designer contacted the company’s Salesforce admin and together they divided the requirement into these tasks:

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
      <colgroup>
        <col style="width:50%">
        <col style="width:50%">
      </colgroup>
      <thead class="slds-text-title_caps ">
        <tr class="">
          <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d8824e76">Task</th>
          <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d8824e79">Description</th>
        </tr>
      </thead>
      <tbody>
        <tr class="">
          <td data-label="Task" class="slds-cell-wrap" style="vertical-align:top;" headers="d8824e76 ">
            <a href="https://help.salesforce.com/s/articleView?id=ind.example_create_a_decision_matrix_to_get_step_based_discount_percent.htm&amp;type=5&amp;language=en_US" target="_blank">Create a decision
              matrix to calculate the discount percent based on the step count from the step
              challenge.</a>
          </td>

          <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d8824e79 ">The matrix uses an input column with the datatype number range to capture the step
            count. The matrix captures the discount percent in the output column for these
            ranges.</td>

        </tr>
        <tr class="">
          <td data-label="Task" class="slds-cell-wrap" style="vertical-align:top;" headers="d8824e76 ">
            <a href="https://help.salesforce.com/s/articleView?id=ind.create_dm_for_age_based_discount.htm&amp;type=5&amp;language=en_US" target="_blank">Create a decision
              matrix to get age-based discount.</a>
          </td>

          <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d8824e79 ">The matrix uses an input column with the data type number range to define the age
            range. The matrix captures the discount percent in the output column for these
            ranges.</td>

        </tr>
        <tr class="">
          <td data-label="Task" class="slds-cell-wrap" style="vertical-align:top;" headers="d8824e76 ">
            <a href="https://help.salesforce.com/s/articleView?id=ind.example_es_calculate_discounted_fees.htm&amp;type=5&amp;language=en_US" target="_blank">Create an expression
              set and its version to design the end-to-end rule to calculate the discounted gym
              membership.</a>
          </td>

          <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d8824e79 ">
            <p>The expression set version: </p>
            <ul>
              <li>Takes the step count as an input and looks up the decision matrix to get the step-based
                discount.</li>
              <li>Uses the contact’s birth date to calculate age.</li>
              <li>Passes the contact’s age to the age-based discount matrix to get the additional
                discount.</li>
              <li>Calculates the total discount by adding the age-based and the step-based discounts.</li>
              <li>Calculates the discounted premium by subtracting the total discount percent from the
                base membership fee of $1,000.</li>
              <li>Enables Decision Explainer for customer service representatives to understand the logic
                behind the discounted membership fee for a specific contact.</li>
            </ul>
          </td>

        </tr>
        <tr class="">
          <td data-label="Task" class="slds-cell-wrap" style="vertical-align:top;" headers="d8824e76 ">
            <a href="https://help.salesforce.com/s/articleView?id=ind.invoke_es_from_flow.htm&amp;type=5&amp;language=en_US" target="_blank">Create a flow to run
              the expression set and return the output to the flow.</a>
          </td>

          <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d8824e79 ">
            <ul>
              <li>The flow captures the contact’s step count and passes it to the expression set
                action.</li>

              <li>The expression set action is configured to use a contact’s record ID as the context in
                which the flow and the expression set run.</li>

              <li>The expression set action returns the discounted membership fees to the flow.</li>

              <li>The flow then updates the contact record with the discounted fees.</li>

            </ul>
          </td>

        </tr>
        <tr class="">
          <td data-label="Task" class="slds-cell-wrap" style="vertical-align:top;" headers="d8824e76 ">
            <a href="https://help.salesforce.com/s/articleView?id=ind.add_the_flow_to_the_record_detail_page.htm&amp;type=5&amp;language=en_US" target="_blank">To launch the flow for
              a contact, add the flow action to the contact record detail page.</a>
          </td>

          <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d8824e79 ">
            <ul>
              <li>The company’s customer service representatives can launch the flow for a contact, and
                enter the contact’s step count for the previous week.</li>

              <li>The flow runs in the background and updates the Gym Membership Fees field for the
                contact record.</li>

            </ul>
          </td>

        </tr>
        <tr class="">
          <td data-label="Task" class="slds-cell-wrap" style="vertical-align:top;" headers="d8824e76 ">
            <a href="https://help.salesforce.com/s/articleView?id=ind.view_decision_explainer_log_history.htm&amp;type=5&amp;language=en_US" target="_blank">View the action log for
              the flow.</a>
          </td>

          <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d8824e79 ">The customer service associates can see the Decision Explainer Log History on the
            contact’s record detail page to check how the gym membership fees for the contact were
            calculated.</td>

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

- **[Example: Create a Decision Matrix to Get Step-Based Discount Percent](https://help.salesforce.com/s/articleView?id=ind.example_create_a_decision_matrix_to_get_step_based_discount_percent.htm&release=264.0.0&type=5)**  
    Create a decision matrix and configure its version with an input column for number of steps, and an output column with the corresponding discount percent based on a number range of steps.
- **[Example: Create a Decision Matrix to Get Age-Based Discount](https://help.salesforce.com/s/articleView?id=ind.create_dm_for_age_based_discount.htm&release=264.0.0&type=5)**  
    Create a decision matrix and configure its version with an input column for age, and an output column with corresponding discount percent based on the age range.
- **[Example: Create an Expression Set to Calculate Discounted Membership Fees](https://help.salesforce.com/s/articleView?id=ind.example_es_calculate_discounted_fees.htm&release=264.0.0&type=5)**  
    Configure the expression set version to calculate a contact’s age from their birth date, look up the contact’s step count to get the steps-based discount, and return the discounted gym membership fee after subtracting the total discount from the base membership fee.
- **[Example: Create a Flow to Run the Expression Set and Update the Record](https://help.salesforce.com/s/articleView?id=ind.invoke_es_from_flow.htm&release=264.0.0&type=5)**  
    Create an input form to capture a contact’s step count and pass it to the expression set action. Configure the flow to update the contact record with the expression set’s output.
- **[Example: Add the Flow to the Contact Record Page and Run the Flow](https://help.salesforce.com/s/articleView?id=ind.add_the_flow_to_the_record_detail_page.htm&release=264.0.0&type=5)**  
    To enter the step count for a contact from the contact’s record page, and pass the contact’s record ID to the flow from the same page, add a flow component to the Contact Record Page.
- **[Example: View Decision Explainer Log History](https://help.salesforce.com/s/articleView?id=ind.view_decision_explainer_log_history.htm&release=264.0.0&type=5)**  
    View the action log for the expression set that was run from the flow for a contact record.

#### See Also

- [Create an Explainability Message Template](https://help.salesforce.com/s/articleView?id=ind.create_explainability_message_templates.htm&release=264.0.0&type=5 "Explainability message templates store explanation messages, and can be referenced in an expression set version step to explain the step’s result. You can use expression set message tokens in your message templates as placeholders for expression set version resources. Rule designers can then map the tokens to the resources from the expression set version where the template is used. When the expression set runs, the explanations dynamically show the values of the mapped resources.")
- [Show Rule Explanations to Users](https://help.salesforce.com/s/articleView?id=ind.use_decision_explainer_in_expression_sets.htm&release=264.0.0&type=5 "When Decision Explainer is available in your Salesforce org, you can show your users the explanations for expression set version step results. The explanations are stored in explainability message templates that your admin creates and maintains.")
- [Show Rule Explanations to Users (Example)](https://help.salesforce.com/s/articleView?id=ind.show_rule_explanations_to_external_users_example.htm&release=264.0.0&type=5 "This example shows how you can configure an expression set version to show step-result explanations to external users. The example also shows how to preview the explanations that your users see.")
- [Decision Explainer for Expression Sets](https://help.salesforce.com/s/articleView?id=ind.decision_explainer.htm&release=264.0.0&type=5 "Use Decision Explainer with Business Rules Engine to show your users explanations for the results of steps in an expression set, and to capture action logs for expression set runs. Store explanations for expression steps in explainability message templates. And then add the templates to your expression set steps for which you want to show explanations. When you simulate the expression set version, switch to the Concise view option to preview how your users see the explanations.")