Skip to main content
Join us at TDX in San Francisco or on Salesforce+ on March 5-6 for the Developer Conference for the AI Agent Era. Register now.

Explain Business Rule Results to End Users

Learning Objectives

After completing this unit, you’ll be able to:

  • Add explanation messages in expression sets.
  • Discuss how to show explanations to users.
  • Disable explanations in expression sets.

Create Explainability Message Templates

The Zercovanian government is trying to build trust with their citizens. It’s easiest to form trust when you act transparently. Jessica knows how important this initiative is, so she bakes a little special something into her expression set by adding explanations to rules. These explanations tell the citizens how a certain rule was executed and what the results are.

Zercovana’s Salesforce admin has already created and stored these explanations as explainability message templates.

Expression Set Element Name

Explainability Message Template Name

Message

Base Premium

FamilyPremiumPass

We've calculated your family premium based on your number of dependents.

FamilyPremiumFail

Something went wrong. We weren't able to calculate your family premium.

Disability Severity

DisabilitySeverityPass

We've captured your disability severity status based on the status you entered from the provided options.

DisabilitySeverityFail

Something went wrong. We weren't able to capture your disability severity status.

Additional Subsidy

AdditionalSubsidyPass

We've calculated the subsidy based on your disability severity and veteran status.

AdditionalSubsidyFail

Something went wrong. We weren't able to calculate the subsidy based on your disability severity and veteran status.

Applicant Age

AgeCalculationPass

We've calculated your age based on the birthdate you provided in the contact details.

AgeCalculationFail

Something went wrong. We weren’t able to calculate your age based on the birthdate you provided.

While creating expression sets, Jessica uses these templates to easily add explanations to expression set elements.

Add Explanations in Expression Sets

Jessica already has the explainability message templates available to her. She just has to associate them with the corresponding steps in the expression set to show the messages to users if the step conditions are met.

Here’s how to associate the explainability message templates to the Insurance Premium Calculation expression set.

  1. Click [Alt text: App Launcher], then find and select Expression Sets.
  2. Select Insurance Premium Calculation.
  3. Select the Insurance Premium Calculation V1 expression set version to open it in the expression set builder.
  4. Click Deactivate if the expression set version is active.
  5. Click Expression Set Properties .
  6. Select the Show decision explanation checkbox.
  7. Click Save.
  8. In the expression set builder canvas, select the Base Premium lookup table element.
  9. Click Element Details .
  10. Under the Decision Explainer section, select Show decision explanation and specify these details.
    • When Step Returns Output: FamilyPremiumPass
    • When Step Errors: FamilyPremiumFail
  1. Similarly, assign these explainability message templates to the respective expression set elements.

Expression Set Elements

When Step Returns Output

When Step Errors

Disability Severity

DisabilitySeverityPass

DisabilitySeverityFail

Additional Subsidy

AdditionalSubsidyPass

AdditionalSubsidyFail

Applicant Age

AgeCalculationPass

AgeCalculationFail

  1. Click Save.

Show Explanations to Users

Jessica is now excited to validate the explanations that she added in the expression set and see how it will appear to the users.

Here’s how she validates the explanations.

  1. Open the Insurance Premium Calculation V1 expression set version in expression set builder.
  2. Click Simulate.
  3. Enter the following details in the Variables section.
    • Dependents: 3
    • Veteran: True
  4. Enter the following details in the Field Aliases section.
    • InsurancePremium.DisabilitySeverity: Mild
    • InsurancePremium.ApplicantBirthdate: May 14, 1980
    • InsurancePremium.ApplicantIncome: 35000
  5. Click Simulate.
  6. To view the explanations, click the Detailed View drop-down menu and select Concise View.

Detailed View drop-down menu with Concise View selected.

Here’s how the explanations appear.

Simulation output in concise view showing decision explanations.

Click View Details to view the element output or calculations.

View Details section showing the element output.

You can see the output of the Base Premium lookup table calculated based on the number of dependents and veteran status input values.

Disable View Details

Jessica has been informed by the Zercovanian leadership that certain steps contain sensitive data and shouldn’t be shown to users. So, she disables the View Details section for a step element.

  1. In the Insurance Premium Calculation V1 expression set version, select the Base Premium lookup table element.
  2. Click Element Details .
  3. Deselect Include in Output.
  4. Click Save.

Element Details section menu.

Here’s how to validate the change.

  1. Click Simulate.
  2. Enter the following details in the Variables section if they aren’t populated by your last test.
    • Dependents: 3
    • Veteran: True
  3. Enter the following details in the Field Aliases section if they aren’t populated by your last test.
    • InsurancePremium.DisabilitySeverity: Mild
    • InsurancePremium.ApplicantBirthdate: May 14, 1980
    • InsurancePremium.ApplicantIncome: 35000
  4. Click Simulate.
  5. To view the explanations, click the Detailed View drop-down menu and select Concise View.

The View Details section is now disabled for the Base Premium element.

Simulation output in concise view showing decision explanations with one of the View Details section disabled.

Jessica can now enable or disable the View Details section while showing the decision explanations for any expression set element.

Disable Explanations for a Step Element

Now, Jessica is aware that there are situations where she doesn’t want to show the explanations for certain step elements.

Here’s how she disables explanations for an element.

  1. In the Insurance Premium Calculation V1 expression set version, select the Disability Severity calculation element.
  2. Click Element Details .
  3. Deselect Show decision explanation.
  4. Click Save.

Here’s how she validates this change.

  1. Click Simulate.
  2. Enter the following details in the Variables section if they aren’t populated by your last test.
    • Dependents: 3
    • Veteran: True
  3. Enter the following details in the Field Aliases section if they aren’t populated by your last test.
    • InsurancePremium.DisabilitySeverity: Mild
    • InsurancePremium.ApplicantBirthdate: May 14, 1980
    • InsurancePremium.ApplicantIncome: 35000
  4. Click Simulate.
  5. To view the explanations, click the Detailed View drop-down menu and select Concise View.

Here’s how the output with decision explanation looks like.

Simulation output in concise view showing decision explanations without Disability Severity.

Notice that the decision explanation for the Disability Severity element is no longer shown.

Healthy Outcomes for Zercovana

Jessica is excited to know that the Zercovana government’s initiatives and requirements are easily captured digitally using Business Rules Engine components. She can add complex rules to calculate the subsidies for the citizens who meet different subsidy criteria. Now, it’s easy to calculate the final health insurance premium amount for the various sections of the society. The Zercovana government is ready to implement its various social programs faster through digital transformation tools such as Business Rules Engine.

In this module, you learned how to create decision matrices and use them in expression sets to create advanced rules. You got to know how to test an expression set using Salesforce Flow. Plus, you explored how to add decision explanations to step elements to see additional details for a step. Now, you’re ready to build more advanced rules using Salesforce Business Rules Engine.

Resources

Hands-on Challenge

+500 points

Get Ready

You’ll be completing this unit in your own hands-on org. Click Launch to get started, or click the name of your org to choose a different one.

Your Challenge

Add an Explanation to Expression Set Step Elements
Add explainability message templates to expression set step elements and show how these messages appear in output.
  • In the Insurance Payment V2 expression set, configure these details for the Age Based Subsidy 
    lookup table element.
    • Enable Include in Output and Show decision explanation settings.
    • Add these explainability message templates to the ‘Age Based Subsidy’ lookup table element.
      • When Step Returns Output: AgeSubsidyPass
      • When Step Errors: AgeSubsidyFail
  • Simulate the Insurance Payment V2 expression set with these input details.
    • Dependents: 3
    • Veteran: True
    • InsurancePremium.ApplicantBirthdate: February 2, 1971 (we won’t check the actual date)
    • InsurancePremium.ApplicantIncome: 30000
    • InsurancePremium.DisabilitySeverity: Severe
  • Change the output view from Detailed View to Concise View.
Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback