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.

Create a Grouped Decision Matrix

Learning Objectives

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

  • Create a grouped decision matrix.
  • Test the grouped decision matrix using an expression set.

Prepare the Hotel Cost Plan

Take an example of a hospitality company that has a chain of hotels in multiple cities and provides different types of rooms. The hotel room per-night charges depend on the city and breakfast options. The company wants to revise ‌room charges for each city. All the details are captured in these tables for easier reference.

New York City

Room Type

Breakfast Included?

Per-Night Price (USD)

Standard

No

40

Standard

Yes

50

Executive

No

60

Executive

Yes

70

Superior

No

80

Superior

Yes

90

San Francisco

Room Type

Breakfast Included?

Per-Night Price (USD)

Standard

No

50

Standard

Yes

55

Executive

No

75

Executive

Yes

80

Superior

No

95

Superior

Yes

100

Create a Grouped Decision Matrix

Now that you know the requirements well, it’s time to create a grouped decision matrix.

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 Matrix, and then click Next.
  5. Enter these details.
    • Name: Hotel Room Cost
    • Type: Grouped
    • Group Key: City
  6. Save your work.

You’ve successfully created the grouped decision matrix.

Update the Group Key Value for the First Version

Next, create the group decision matrix versions to capture the requirements for each city. Start with editing the first grouped decision matrix version created earlier for New York City.

  1. On the Hotel Room Cost decision matrix record page, click the Related tab.
  2. In the Decision Matrix Versions related list, click Hotel Room Cost V1.
    The Hotel Room Cost decision matrix record page showing the available decision matrix versions.
  3. Click Edit.
  4. For Name, remove the existing name and enter Hotel Room Cost NYC.
  5. For Group Key Value, enter New York City.
  6. Save your changes.

Add Column Headers to the Decision Matrix

Next, add the specific input and output columns based on the column headers in the New York City requirements table.

  1. On the Hotel Room Cost NYC matrix record page, click the Matrix tab.
  2. Click Add Column.
  3. On the Add Column window, provide these details.
    • Column Header: Room_Type
    • Header Type: Input
    • Data Type: Text
  4. Click Add Column.
  5. Provide these details for the second column.
    • Column Header: Breakfast_Included
    • Header Type: Input
    • Data Type: Boolean
  6. Click Add Column.
  7. Provide these details for the third column.
    • Column Header: Per_Night_Price
    • Header Type: Output
    • Data Type: Currency
      The Add Column window showing the Column Header, Header Type, and Data Type columns, and the corresponding data.
  8. Click Done.

Add Rows and Data to the Decision Matrix

Now, add rows and data in each row of the matrix. To capture the data mentioned in the Breakfast Included column, use the boolean data type.

  1. Click Add Row.
  2. In the Room_Type column, hover over the first row, and click Edit field pencil icon .
  3. For room type, enter Standard.
  4. In the Per_Night_Price column, hover over the first row, and click Edit field pencil icon .
  5. For per-night price, enter 40.The Matrix tab showing the Standard room type, and its breakfast option and per-night price.
  6. Repeat steps 1–5 to enter data for the remaining room types. For room types that include breakfast, click Edit field pencil icon in the Breakfast_Included column and select the checkbox.
  7. Save your changes. If the table with the added data doesn’t appear, refresh the page.The Matrix tab showing all the room types, and their corresponding breakfast options and per-night price.
  8. Click Activate.

In the decision matrix, the Boolean data type column has a checkbox to indicate whether the column is included or not. If the checkbox is selected, the column is included and if the checkbox isn't selected, the column isn't included. You use the Boolean data type in a True or False input scenario.

Create a New Grouped Decision Matrix Version

Now, create a new version of the grouped decision matrix to capture the details for San Francisco from the Hotel Room Cost grouped decision matrix.

  1. In the Hotel Room Cost decision matrix record page, click the Related tab.
  2. Click New.

The Hotel Room Cost decision matrix record page showing the available decision matrix versions.

  1. Provide these details.
    • Name: Hotel Room Cost SF
    • Rank: 2
    • Version Number: 2
    • Group Key Value: San Francisco
  2. Save your work.
  3. Just like you did for New York City in the previous section, add rows and data for the San Francisco grouped decision matrix version.
  4. Save your changes.
  5. Click Activate.

That’s it! Your grouped decision matrix versions are now ready. Easy right?

You can create multiple decision matrix versions within the same decision matrix, but each version must have a unique rank. You can simultaneously activate multiple versions of a decision matrix. When you call a decision matrix and more than one activated version of the decision matrix exists, the version with the highest rank is chosen. For example, if two activated versions have rank 1 and rank 2, the version with rank 2 is chosen.

Add the Decision Matrix to an Expression Set

You must be excited to see your grouped decision matrix in action. You can call the decision matrix in an expression set to test it. Here’s how you do it.

First, create an expression set.

  1. Click App Launcher , then find and select Expression Sets.
  2. Click New.
  3. For Name, enter Get Hotel Room Cost.
  4. For Usage Type, select Default.
  5. Save your changes.
  6. On the Details page, under the Expression Set Versions related list, click Get Hotel Room Cost V1. The expression set version opens in the Expression Set Builder.The expression set details tab showing the available expression set versions.
  7. In the Expression Set Builder, click Expression set properties .
  8. For Rank, enter 1.
  9. Save your changes.

Next, call the grouped decision matrix from the expression set version. To do that, add a lookup table step element in the Expression Set Builder canvas.

  1. In the Expression Set Builder canvas, click Add element .
  2. Find and select Lookup Table.
  3. In the Lookup Table Details field, find and select Hotel Room Cost.The Hotel Room Cost lookup table showing the input and output variables.
  4. Save your changes.

Simulate and Test the Decision Matrix

Awesome! You’ve added the grouped decision matrix to the expression set version. Now, it’s time to test it. To verify that the grouped decision matrix works as expected, simulate the expression set version with a few sample input values.

  1. In the Expression Set Builder canvas, click Simulate.
  2. Under Variables, provide this input data.
    • Breakfast_Included: True
    • City: San Francisco
    • Room_Type: Executive
  3. Click Simulate.
  4. Click Expand in the canvas for results.
    The Hotel Room Cost lookup table showing the input and output variables and the corresponding results.

The per-night price calculated based on the entered input data comes to $80. The results match the data as defined in the San Francisco table. Congratulations! The grouped decision matrix is working as expected.

In this unit, you learned how to create a grouped decision matrix and its versions. You also learned how to use the grouped decision matrix in an expression set and test it. In the next unit, explore decision tables.

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

Create a Grouped Decision Matrix
Create a grouped decision matrix to define the hotel room plans for Austin and Denver cities.
  • Create a grouped decision matrix.
    • Name: Hotel Room Plans
    • Type: Grouped
    • Group Key: City
  • Edit the Hotel Room Plans grouped decision matrix.
    • Name: Hotel Room Plans Austin
    • Group Key Value: Austin
  • Create columns.
    • Input Columns
      • Column Header: Room_Type
      • Header Type: Input
      • Data Type: Text
      • Column Header: Breakfast_Included
      • Header Type: Input
      • Data Type: Boolean
    • Output Column
      • Column Header: Per_Night_Price
      • Header Type: Output
      • Data Type: Currency
  • Add data to the grouped decision matrix.
    • Row 1
      • Room Type: Standard
      • Breakfast Included: No
      • Per Night Price: 30
    • Row 2
      • Room Type: Standard
      • Breakfast Included: Yes
      • Per Night Price: 36
    • Row 3
      • Room Type: Executive
      • Breakfast Included: No
      • Per Night Price: 38
    • Row 4
      • Room Type: Executive
      • Breakfast Included: Yes
      • Per Night Price: 44
  • Activate the Hotel Room Plans Austin decision matrix version.
  • Create a grouped decision matrix version from the Hotel Room Plans decision matrix.
    • Name: Hotel Room Plans Denver
    • Rank: 2
    • Version Number: 2
    • Group Key Value: Denver
  • Add data to the grouped decision matrix.
    • Row 1
      • Room Type: Standard
      • Breakfast Included: No
      • Per Night Price: 52
    • Row 2
      • Room Type: Standard
      • Breakfast Included: Yes
      • Per Night Price: 56
    • Row 3
      • Room Type: Executive
      • Breakfast Included: No
      • Per Night Price: 65
    • Row 4
      • Room Type: Executive
      • Breakfast Included: Yes
      • Per Night Price: 70
  • Activate the Hotel Room Plans Denver decision matrix version.
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