Skip to main content
Gainsight Inc.

Tutorial - Custom Grouping, Time Series, and Pivoting using Bionic Rules

In this tutorial, we will use Bionic Rules and demonstrate its capabilities with a scenario. This tutorial also demonstrates that by creating a single Bionic Rule, you can achieve goals which were only possible earlier using multiple rules.    

Following are the goals we intend to achieve using a single bionic rule: 

  1. Fetch all the cases from the Case object (Fetch Task). 
  2. Pivot: After the cases are gathered in a output dataset, pivot it on Priority field (Pivot Task).
  3. Time Series Filter: Group the cases that are created in 14 day period (Transformation Task). 
  4. Custom Group: Finally, merge the pivoted dataset (Priority) and the output of cases created in 14-days (Merge Task). 
  5. Load to MDA

Fetch all cases from the Case object

  1. In the Rules Engine, create a new Bionic rule.
  2. In the Setup Rule screen, click DATASET TASK
  3. Provide a Task Name. The Output Dataset Name gets populated automatically. 
  4. Select Native Data and select Case as the source object. 

  1. Drag the following fields and drop at the Show section: 
    1. Account ID: This is a mandatory field for building a rule. 
    2. Account ID Name: To get the account names related to all the cases. 
    3. Priority: To get the priority of all the cases. This field is important for this tutorial. 
    4. Created Date: This field is useful to filter the cases that fall in a 14-day period. 
    5. Case Number: This field is used to get the number of the case. 
  2. Click SAVE

Pivot the dataset on Priority

Using the output dataset of the previous task (GetAllCases), pivot the dataset based on Priority. 

  1. In the Setup Rule screen, click + TASK and select Pivot
  2. Select the output dataset name from the previous task as the source object (In this example, GetAllCases). 
  3. Select Account ID, ID, and Created Date as Show fields. 
  4. Drag Priority from the fields section and drop in Pivot On section. The Configure Conditions dialog appears. 

  1. Add conditions in the dialog. In this tutorial, we are counting the number of high priority cases. Configuring a condition is mandatory to proceed. 
  1. Drag Account ID and Created Date fields in the Group By section. 
  2. Click SAVE.

Filter the cases in a 14-day period 

In this step, we’ll group the cases that are created in a 14-day period. 

  1. In the Setup Rule screen, click + TASK and select Transformation
  2. Select the source as GetAllCases
  3. Group by Account ID and Case Number
  4. Add the following filter criteria:  
    1. Created Date <= 14. From the rule date, subtract 14 days. 
    2. From the rule run date, subtract 15 days so that the rules run on the 14th and 15th day are also included. 
  5. In the Advanced Logic section, type A AND B. This is to ensure values from both the filters are included. 
  6. Click SAVE

Merge outputs of Pivoted task and 14-day period

The output datasets of Pivoted task (CasePivotPriority) and 14-day period (Getting2weekoldcases) are merged using a Merge task. 

  1. In the Setup Rule screen, click + TASK and select Merge
  2. In the Criteria section, select the output datasets. CasePivotPriority and Getting2weekoldcases
  3. Select the join type as Retain all records from left dataset.
  4. In the Show Fields section, select the fields that you want to include in the final dataset. 
  5. Click SAVE.

Load to MDA

Once you have the final dataset from the previous step, you can load the dataset to MDA. 

  1. Select Load to MDA Subject Area
  2. Select an object from Object Name list. Once you select the object name, you can see the field mappings. 
  3. Select Upsert from the Operation list. 
  4. Map the fields from output dataset with the MDA object’s fields. 
  5. Click SAVE. Run the rule to see the output.