You are here:
Group Rules to Optimize the Calculations (Managed Package)
Step-by-step guide to group rules and optimize the rollup of cash balances of all financial accounts to the household.
This is a Financial Services Cloud managed package feature.
- Rollup by Lookup (RBL) framework is available and enabled.
For more information, see Enable the RBL Using Data Processing Engine Framework.
- Familiarity with data transformation operations such as joins and appends.
- Familiarity with adding formulas to RBL rules.
Let’s say there’s a requirement to roll up cash balances of all financial accounts to the household with these two rules.
- The cash balances are stored in the cash balance field of the Financial Account object.
- The rollup value is stored in the cash balance field of the Accounts object.
You want to group these two rules in a single Data Processing Engine (DPE) definition to optimize the rollup operation.
The Data Processing Engine Design (DPE) plan to achieve the requirement:
- Create two data sources with source objects as Accounts and Financial Accounts.
- Filter the results of the Accounts data source to consider only the RecordType, IndustriesHousehold.
- Aggregate the Financial Accounts with two aggregates:
- Groupby the household id field and sum the balance field.
- Groupby the household id field and sum the cash balance field.
- Create a left outer join to join the results of steps 2 and 3.
This join operation results in a single table that includes the Account Id fields, the aggregate of the balance fields, and the aggregate of the cash balance fields.
- Writeback with the results of step 4 to the Accounts data source.
-
Create a data processing engine definition.
- From Setup, in the Quick Find box, enter Data Processing Engine, and then select Data Processing Engine.
- Click New.
- Enter the name of the definition as Group Total HH Portfolio Value and Calculate.
- Click Create.
-
Create a data source (Accounts) and select its objects and fields.
- On the Data Processing Engine definition page, click New Data Source.
- Enter the name as Account and Recordtype.
- Save your changes.
- From the Source Object dropdown list, search for and select Account.
- Click Select Fields.
-
Select the Id and Balance__c fields.
Note Balance__c is a custom field in the Accounts object to which we will roll up the total cash balance.
- Enter the alias name for Id as AccountId and for Balance__c as AccountBalance.
- Click Done.
-
Select the related objects and fields for the Account and Recordtype data source.
- Click Add Related Object.
- Select the RecordType object.
- Click Select Fields.
- Select the DeveloperName and Id fields.
- Enter the alias name for Id as RecordTypeId and for DeveloperName as DeveloperName.
- Click Done.
- Save your changes.
-
Create a data source (Financial Account) and select its objects and fields.
- On the Data Processing Engine definition page, click New Data Source.
- Enter the name as Financial Accounts.
- Save your work.
- From the Source Object list, search for and select Financial Account.
- Click Select Fields.
- Select the Household__c, Balance__c, and CashBalance__c fields.
- Enter the alias name for Household__c as FAHouseholdId, for Balance__c as FABalance, and for CashBalance__c as FACashBalance.
- Click Done.
- Save your changes.
-
Create a node to filter the Account and Recordtype data source.
- On the Data Processing Engine definition page, click New Node.
- In the Select Node Type dropdown list, select Filter.
- Enter the name as Filter Household Recordtypes.
- Click Create.
-
Configure the filter.
Configure the filter so that the result of the Filter Household Recordtypes data source is a filtered set of records with RecordType as IndustriesHousehold. Define these filter conditions.
- Source Node: Account and Recordtype
- Select Records When: All Conditions are met (AND)
- Field: DeveloperName
- Operator: Equals
- Type: Field
- Value: IndustriesHousehold
- Click Done.
- Save your changes.
Here’s what the filter conditions look like in the Filter Household Recordtypes data source page.
-
Create a node to aggregate the values of the FAbalance fields in the Financial Accounts
data source.
- In the Data Processing Engine definition page, click New Node.
- In the Select Node Type dropdown list, select Group and Aggregate.
- Enter the name as Aggregate FA Balances.
- Click Create.
- From the Source Node list, search for and select Financial Accounts.
- Click Select Group Fields.
- Select the Household__c field.
-
Click Add Aggregate and define the first aggregate.
Under the Aggregate section, configure the aggregate as follows:
- Alias: AggregatedSum
- Function: Sum
- Aggregate Field: Balance__c
-
Click Add Aggregate again and define the second aggregate.
Under the Aggregate section, configure the aggregate as follows:
- Alias: CashBalance
- Function: Sum
- Aggregate Field: CashBalance__c
- Click Done.
- Save your changes.
Here’s what the aggregation definitions look like in the Aggregate FA Balances data source page.
-
Create a node to join the results of the Filter Household Recordypes node and the Aggregate
FA Balances node.
- On the Data Processing Engine definition page, click New Node.
- In the Select Node Type dropdown list, select Join.
- Enter the name as Join FA Aggregates and Household.
- Click Create.
-
Configure the join.
Define the following as join conditions.
- Join Type: Left Outer
- First Node: Filter Household Recordypes
- Fields (first node): AccountId
- Second Node: Aggregate FA Balances
- Fields (second node): AggregatedSum and CashBalance
-
Map the join fields.
Under the Map Fields section, map fields from the first node to fields from the second node.
- Map the Id field from filter to the Household__C field from the Financial Accounts data source.
Here’s what the join conditions look like in the Join FA Aggregates and Household data source page.
-
Create a node to write back the results to the Accounts data source.
- On the Data Processing Engine definition page, click New Node.
- In the Select Node Type dropdown list, select Writeback.
- Enter the name as Account Writeback.
- From the Source Node list, search for and select Join FA Aggregates and Household.
- In the Action Type dropdown list, select Upsert.
- In the Target Object dropdown list, select Account.
-
Define the field mappings.
Under the Field Mapping section, map the Source Node fields to Target fields.
- Map the FAHouseholdId field to the Id field.
- Map the AggregateSum field to the Balance__c field.
- Map the CashBalance field to the Total_Primary_Cash_Value__c field.
Here’s what the writeback configurations like in the Account Writeback data source page.
- Save your changes.
You can now activate and execute the RBL rule to group rules and optimize the calculations. After you activate the rule, you can also invoke them as actions in flows to orchestrate processes.

