Loading
Salesforce now sends email only from verified domains. Read More
Business Rules Engine
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
          Example: Create an Expression Set to Calculate Discounted Membership Fees

          Example: Create an Expression Set to Calculate Discounted Membership Fees

          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.

          Required Editions

          User Permissions Needed
          To create a field alias for the Birthdate field in the Contact object: System Administrator for a Salesforce org with Business Rules Engine
          To create the expression set, and design and activate its version Rule Engine Designer

          The field alias (Applicant.Birthdate) for using the value of the Birthdate field from the Contact object must be created in Setup, and available to use in the expression set. See Create Source Field Aliases.

          Create an expression set named AnnualGymMembership. In Version 1 of this expression set, add steps to use the contact’s inputs and return the discounted gym membership fees.

          1. From the app navigation menu of Business Rules Engine, select Expression Sets.
          2. Click New.
          3. Enter AnnualGymMembership as the name, and save your work.
            The expression set and its first version are created.
          4. On the record page for the new expression set, on the Versions tab, select AnnualGymMembership V1, and then click Open in Expression Set Builder.
          5. Set the properties for the expression set version:
            1. Click Gear icon, which opens the properties panel., and enter a start date time for the expression set version.
            2. Enter a rank.

              The default is 1.

            3. Select Show decision explanation.
            4. Close the Expression Set Properties panel.
          6. Create resources for the expression set:
            1. Click resource manager icon.
            2. Click Add Resource, and then create these variables and constants.
              Note
              Note After adding a resource, to add the next resource, click Done and New. After adding all required resources, click Done.
              Resources
              Resource Type Variable NAME Data Type Decimal Default Value
              Constant GymFees Currency 0 1000
              Variable ContactAge Number 0
              Variable TotalDiscount Percent 0
              Variable DiscountedGymFees Currency 2
            Tip
            Tip Save the version after making any change.
          7. To get the discount percent based on the step count, add a Lookup Table step.
            1. Click Add icon in expression set builder canvas. on the builder canvas, and select Lookup Table.
            2. Search for and select StepsBasedDiscount.
              The matrix is added and the input and output columns from the matrix appear as local variables in the resources list.
          8. To calculate the contact’s age from their birth date, add a Calculation step.
            1. Click Add icon in expression set builder canvas. on the builder canvas, and select Calculation.
            2. In the Formula field, search for and select AGE (Date).
            3. To replace Date in Age (Date) with the value of the Birthdate field on the Contact object, search for and select Applicant.Birthdate so that the formula looks like this: Age(Applicant.Birthdate).
              Here. Applicant is the object alias for Contact, and Birthdate is the field alias for the Birthdate field in Contact.
            4. In the Output Variable field, search for and select ContactAge.
          9. To use the contact’s age to a get the applicable age-based discount, add a Lookup Table step.
            1. Click Add icon in expression set builder canvas. on the builder canvas, and select Lookup Table.
            2. Search for and select AgeBasedDiscount.
              The matrix is added and the input and output columns from the matrix appear as local variables in the resources list.
          10. To calculate the total discount based on the contact’s age and step count, add a Calculation step.
            1. Click Add icon in expression set builder canvas. on the builder canvas, and select Calculation.
            2. In the Formula field, enter this formula: StepBasedDiscount_Discount + AgeBasedDiscount_Discount.
            3. In the Output Variable field, search for and select TotalDiscount.
          11. To calculate the discounted gym membership fees, add a Calculation step.
            1. Click Add icon in expression set builder canvas. on the builder canvas, and select Calculation.
            2. In the Formula field, enter this formula: GymFees - ( TotalDiscount * GymFees ).
            3. In the Output Variable field, search for and select DiscountedGymFees.
            End-to-end steps in the expression set version.
          12. Select each step individually, click Open element details panel., and select Include in output.
            Tip
            Tip To save the version, this action is required for at least one step. However, to include step-wise details in the Decision Explainer logs, complete this action for every step.
          13. Click Simulate and test the version by entering sample inputs.
          14. Activate the version.
           
          Loading
          Salesforce Help | Article