Skip to main content
Join the Agentforce Virtual Hackathon to build innovative solutions and compete for a $50k Grand Prize. Sign up now. Terms apply.

Get Started with Decision Tables

Learning Objectives

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

  • Describe decision tables.
  • Create a decision table.
  • Test the decision table using ‌Salesforce flow.
  • Group a business rule and sort the output.

Meet Decision Tables

Decision tables are advanced lookup tables that can use multiple inputs and return multiple outputs for records in your Salesforce org to create complex business rules. You can create decision tables in Business Rules Engine and use them in flows or expression sets. A decision table can read up to 1 million rows. It uses standard objects, custom objects, or custom metadata types to create business rules and provide outcomes based on these rules. The object or the custom metadata type contains fields that are used as inputs and outputs in the decision table.

Find the Flight

Consider an example of a flight aggregator website where you want to check the price and air-miles points for all the flights between China and Australia. To get this information, you provide the required input parameters such as Source and Destination. You can additionally use any of these parameters that the aggregator provides on its web page.

  • Airline Name
  • Class
  • Airline Manufacturer
  • AirMile Points
  • Price

We’ve created an object called Airlines with these fields in your Developer Edition org. We’ve also added some sample data that you can use to create decision tables and test them.

The Airlines object showing the various fields and their respective data.

Create a Decision Table

Now that you’ve captured the requirements, it’s time to create the decision table. Here’s how you do it.

  1. Click App Launcher , then find and select Business Rules Engine.
  2. Click App Navigation Menu and then select Lookup Tables.
    The app navigation menu with the Lookup Tables option highlighted.
  3. Click New.
  4. Select Decision Table and then click Next.
  5. On the New Decision Table page, specify these details.
    • Name: Flight Details
    • API Name: This field auto-populates with Flight_Details
    • Application Usage: Default
    • Decision Table Type: Medium VolumeThe New Decision Table window showing the basic details step.
  6. Click Save & Next.

Add Conditions and Results

Next, choose the source object and source object fields as conditions. For this example, select Source and Destination fields as required Conditions. For Results, select Airline Name, Class, AirMile Points, and Price.

  1. On the Condition & Results step, for Source Object, find and select Airline.
  2. In the Conditions section, specify these details.
    • Source Object Field: Source__c
    • Click + Add Condition
    • Source Object Field: Destination__c
  3. In the Results section, click + Add Results thrice and specify these values for the four source object fields..
    • AirMile_Points__c
    • Class__c
    • Name
    • Price__c
  4. Click Save & Next.
  5. On the Behaviours step, click Save & Next.
  6. On the Preview & Save step, click Finish.
  7. Click Activate.
Note

By default the condition fields are marked as required. If you want to make a condition field as optional, select the corresponding Optional? checkbox.

If you want to learn more about the operators and their functions, refer to Supported Data Type and Operators.

Get the Output

Your decision table with the selected conditions and results is ready. You can now use the decision table in a Salesforce Flow to get the flight details based on the input criteria. We’ve created sample data and configured a Salesforce flow with custom screens for you. Here’s how you get the flight details.

  1. From Setup, in the Quick Find box, enter Flows, and then select Flows.
  2. Find and select Get Flight.
  3. Click Run.
  4. For Source, select China.
  5. For Destination, select Australia.
  6. Click Next.

All the flights between China and Australia are listed. Check out the Airline Name, Class, AirMile Points, and Price details that you selected for these fields, as output in the Flight Details decision table.The flow output screen showing the output with Airline Name, Class, AirMile Points, and Price fields.

Group a Business Rule and Sort the Output

If you have a frequently used condition source object field, you can group your business rules using a group key to reduce the number of rows to process. In the flights example, you create a decision table and group it using the Class condition field. As a result, the decision table splits the table into multiple groups based on the Class field values, such as Economy, Premium Economy, Business, and First Class. Now, when you perform a lookup by specifying a class such as Economy, the lookup considers only the table group associated with that class. When you specify a group key and save your decision table, the grouping process happens in design time and isn’t visible in the decision table UI.

Note

The Group Condition setting is available only if you select the Low Volume decision table type.

You can also specify a sort order for the outcomes based on the values of either a condition or a result field. With sort order, you can display the results in ascending or descending order based on the sort order field. In this example, you sort the flight results in ‌ascending order using the Price field.

  1. Create a decision table using these details.
    • Name: Flight Group
    • API Name: This field auto-populates with Flight_Group
    • Application Usage: Default
    • Decision Table Type: Low Volume
  2. Click Save & Next.
  3. On the Condition & Results step, for Source Object, select Airline.
  4. In the Conditions section, specify these details.
    • Source Object Field: Name
    • Click + Add Condition
    • Source Object Field: Class__c
  5. To group your business rules, click View Group Condition Settings.
  6. On the Group Condition Settings panel, click Add Group Key.
  7. For Group Key, select Class__c.
  8. Click Done and close the Group Condition Settings panel.
  9. In the Results section, click + Add Results twice, and then specify these values for the three Source Object Fields.
    • Destination__c
    • Price__c
    • Source__c
  10. Click Save & Next.
  11. On the Behaviours step, for Sort By, select Price__c.
  12. Click Save & Next.
  13. On the Preview & Save step, click Finish.
  14. Click Activate.

Now, use the Flight Group decision table in a Salesforce flow to see if the results are sorted as expected. We’ve already configured a flow in your Developer Edition org with Airline Name as Green One and Class as Economy.

Here’s how you check the outcome of the flow.

  1. From Setup, in the Quick Find box, enter Flows, and then select Flows.
  2. Find and select Get Flight Group.
  3. Click Run.

Notice that the table lists the flights by Green One airline with the class as Economy. Also, the results are listed in ascending order, from lowest to highest, based on the price.

The flow output screen showing the results.

In this unit, you learned how to create a decision table and test it using ‌Salesforce flow. You also learned how to group a business rule and sort the decision table output. In the next unit, you learn how to aggregate condition input fields and transform results in decision tables. You also learn how to create a decision table using multiple objects as data sources.

Resources

실습 과제

+500 포인트

준비

실무 조직에서 이 유닛을(를) 완료하게 됩니다. Launch(실행)를 클릭하여 시작하거나 조직 이름을 클릭하여 다른 항목을 선택하세요.

내 과제

Create a Decision Table with Multiple Inputs and Multiple Outputs
Create a decision table to check the available flights, air-mile points, and prices using the source and destination as input conditions.
  • Create a decision table.
    • Name: Flight Check
    • API Name: Flight_Check
    • Application Usage: Default
    • Decision Table Type: Medium Volume
  • Add source object, conditions and results.
    • Source Object: Airline
    • Conditions: Source__c and Destination__c
    • Results: Name, AirMile_Points__c, and Price__c
  • Activate the Flight Check decision table.
Salesforce 도움말에서 Trailhead 피드백을 공유하세요.

Trailhead에 관한 여러분의 의견에 귀 기울이겠습니다. 이제 Salesforce 도움말 사이트에서 언제든지 새로운 피드백 양식을 작성할 수 있습니다.

자세히 알아보기 의견 공유하기