Skip to main content
Gainsight Inc.

Customer Categorization with Case Expression Formula field

IMPORTANT - Articles Impacted due to 6.42 July CS Release

Due to the v6.42 July, 2024 release, this article has been impacted. Steps, images, and playable GIFs in this article will soon be updated to reflect the latest changes.

This article explains how to use the Case expression formula field in Rules engine. Gainsight recommends that you refer to the Case Expression section of the Formula Fields in Rules Engine article and then proceed with this article.

Overview

The Case Expression feature in Rules Engine allows you to categorize your data based on various parameters. This feature is reminiscent of the Switch Statement used in various programming languages. This article explains a specific use case in which you can use the Case expression feature to categorize your customers based on the revenue generated by them.

Consider a situation in which you wish to categorize all your customers into Platinum, Gold, Silver and Bronze, based on the revenue generated by the customers. You can easily accomplish this task with the Case Expression. You can create four cases in Case Expression. The requirements for a Customer to be categorized as Platinum can be mentioned in the first case, Gold requirements can be specified in the second case and so on.

M1.png

Assumptions

  • The Company object has a custom field called Account Name. This field stores all the names of the customers.

  • If the MRR of a customer is greater than 4000, the customer is considered to be a Platinum customer.

  • If the MRR of a customer is between 3000 and 3999, the customer is considered to be a Gold customer.

  • If the MRR of a customer is between 2000 and 2999, the customer is considered to be a Silver customer.

  • If the MRR of a customer is less than 2000, the customer is considered to be a Bronze customer.

Create Dataset

To Create Dataset:

  1. Navigate to Administration > Rules Engine.
  2. Click Create Rule. The New Rule window is displayed.
  3. Enter the following details.
    1. Enter a name in the Rule Name field.
    2. (Optional) Select a folder for the rule.
    3. (Optional) Enter a description for the rule. 
  4. Click NEXT.

M2.png

  1. Click DATASET
  2. Select Company as the source object.

M3.png

  1. Drag and drop Account Name and MRR fields to the Show section.
  2. Click Save.
  3. Click <-.

M4.GIF

Create Transformation Task

To Create Transformation Task:

  1. Click + TASK and select Transformation.
  2. Enter a name for the task in the Task Name field.
  3. Select the Source Dataset (here it is Fetch from Company).

M5.GIF

  1. Drag and drop Account Name to the Show section.
  2. Drag and drop Case Expression to the Show section.

M6.GIF

Configure Case Expression

To Configure Case Expression:

  1. Enter Customer Type as the Output Field Label.
  2. Select String as the Output Data Type.
  3. Select:
    1. MRR field
    2. >= operator
    3. Value
    4. 4000

This is the criteria for Platinum customers. If the MRR > 4000, the customer is considered to be Platinum.

1.png

  1. Select Custom in the Then field and enter Platinum Customer.

This is the Case Action which writes the value Platinum customer in output column Customer Type.

M8.gif

  1. Click + Case

  2. Select:

    1. MRR field

    2. >= operator

    3. Value

    4. 3000

  3. Click + Criteria.

  4. Select:

    1. MRR field

    2. < operator

    3. Value

    4. 3999

This criteria is for Gold Customers. The value MRR must be between 3000 and 3999.

M9.gif

  1. Select Custom in the Then field and enter Gold customer.

M10.gif

  1. Similarly, create another two cases for Silver and Bronze customers with MRR between 2000-2999 and MRR less than 1999, respectively.

M11.png

  1. Select Custom and type Invalid Customer in the DEFAULT field.

  2. Click SAVE.

M12.gif

When you execute this rule, the following output is generated.

M13.png

  • Was this article helpful?