Skip to content
Record Split Strategies

Record Split Strategies

In a trigger-based architecture, executing logic on every single record within a transaction is rarely optimal. Record Split Strategies define exactly how the Breezz Framework filters the trigger context, ensuring that subsequent steps are executed only for the records that genuinely require processing.

Because Salesforce transactions often handle bulk data, efficiently narrowing down the processing scope prevents unnecessary executions, reduces governor limit consumption, and keeps your trigger logic clean. Whether you need to process every record, filter by specific business categorizations, evaluate field-level criteria, or implement complex programmatic logic, selecting the right split strategy is essential for building highly performant trigger handlers. Before executing a trigger step, choose the strategy that best fits your filtering requirements from the options below.

All

The trigger will process the entire batch of records present in the transaction context. This strategy is ideal for universal operations - such as standard field initialization, global validation rules, or logging - where no records should be excluded from the execution step.

Record Type

The trigger will process only records that match specifically selected Record Types. Use this strategy when your logic is highly specialized and applies only to a certain category of records within an object. It allows you to safely route execution paths without writing repetitive condition statements.

Record Type

Condition

The trigger will process only records that meet predefined declarative conditions. This allows administrators and developers to define granular, field-based filtering logic directly within the configuration, keeping custom code to an absolute minimum.

Condition

Custom

Allows you to implement a custom Apex class to define programmatic, complex filtering logic that cannot be achieved through standard declarative conditions. This is essential for scenarios requiring cross-object data evaluation, historical state comparisons, or advanced logic.

For example, checking if the status of a case was explicitly changed to ‘Closed’ during the current transaction:

Custom

global class ClosedCaseSplitStrategy implements TriggerRecordsSplitStrategy {
    
    global Boolean canProcess(SObject record, SObject optionalOldRecord) {
        // Cast generic SObjects to the specific Case type
        Case newCase = (Case) record;
        Case oldCase = (Case) optionalOldRecord;
        
        // Check if the current status is 'Closed'
        Boolean isNowClosed = (newCase.Status == 'Closed');
        
        // Check if it's a new record (oldCase == null) 
        // or if the previous status was different than 'Closed'
        Boolean wasNotClosedBefore = (oldCase == null || oldCase.Status != 'Closed');
        
        // The record will be processed only if both conditions are met
        return isNowClosed && wasNotClosedBefore;
    }
}