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:
- Fetch all the cases from the Case object (Fetch Task).
- Pivot: After the cases are gathered in a output dataset, pivot it on Priority field (Pivot Task).
- Time Series Filter: Group the cases that are created in 14 day period (Transformation Task).
- Custom Group: Finally, merge the pivoted dataset (Priority) and the output of cases created in 14-days (Merge Task).
- Load to MDA
Fetch all cases from the Case object
- Navigate to Administration > Rules Engine > Click + RULE.
- Select the Rule Type as Bionic, and enter the Rule Name and Description (optional).
- Click NEXT.
- In the Setup Rule screen, click DATASET TASK.
- Enter the Task Name. The Output Dataset Name is populated automatically.
- Select Salesforce as the data source and Case as the source object.
- Drag and drop the following fields in the Show section:
- Account ID: This is a mandatory field for building a rule.
- Account ID Name: To get the account names related to all the cases.
- ID: This field is used to get the identification of the case.
- Priority: To get the priority of all the cases. This field is important for this tutorial.
- Created Date: This field is useful to filter the cases that fall in a 14-day period.
- Case Number: This field is used to get the number of the case.
- Click SAVE.
Pivot the Dataset on Priority
Using the output dataset of the previous task (GetAllCases), pivot the dataset based on Priority.
- In the Setup Rule screen, click + TASK and select Pivot.
- Select the output dataset name from the previous task as the source object (In this example, Get All Cases).
- Select Account ID, ID, and Created Date as Show fields.
- Drag and drop Priority from the fields section in the Pivot On section. The Configure Conditions dialog appears.
- Add conditions in the dialog. In this tutorial, we are counting the number of high priority cases. Configuring a condition is mandatory to proceed.
- Drag and drop Account ID and Created Date fields in the Group By section.
- Click SAVE.
Filter the cases in the last 14-days
In this step, we’ll group the cases that are created in the last 14-days.
- In the Setup Rule screen, click + TASK and select Transformation.
- Select the source as Get All Cases.
- Select Account ID, ID, and Case Number as Show fields.
- Group by Account ID and Case Number.
- Add the following filter criteria:
- Created Date <= 14. From the rule date, subtract 14 days.
- From the rule run date, subtract 15 days so that the rules run on the 14th and 15th day are also included.
- In the Advanced Logic section, type A AND B. This is to ensure values from both the filters are included.
- Click SAVE.
Merge outputs of Pivoted task and 14-day period
The output datasets of Pivoted task (Pivot the Dataset on Priority) and 14-day period (Filter the Cases in a 14 day Period) are merged using a Merge task.
- In the Setup Rule screen, click + TASK and select Merge.
- In the Criteria section, select the output datasets. Pivot the Dataset on Priority and Filter the Cases in a 14 day Period.
- Select the join type as Retain all records from left dataset.
- In the Show Fields section, select the fields that you want to include in the final dataset.
- Click SAVE.
Load to MDA
Once you have the final dataset from the previous step, you can load the dataset to MDA.
- In the Setup Action screen, click + ACTION and select Merge for Cases.
- Select Load to MDA Subject Area.
- Select an object from Object Name list. Once you select the object name, you can see the field mappings.
- Select Upsert from the Operation list.
- Map the fields from output dataset with the MDA object’s fields.
- Click SAVE. Run the rule to see the output.