Custom Split Strategy
The Custom Split Strategy enables developers to route trigger logic based on custom Apex logic.
This example shows how to use Breezz Triggers to display an error message if a new Case is closed and the Resolution Notes custom field is left empty.
Step 1: Create a Trigger
While you can create a Trigger in several different ways, this example walks through creating one with the Breezz Environment Graph.
ℹ️ For more information about other ways of creating Triggers refer to the Triggers Configuration section.
- Navigate to the Breezz Environment Graph.
- Within the Breezz Environment Graph, select
Triggerand chooseCase.

- Click the Trigger Icon.
ℹ️ Note: For additional information regarding the Breezz Environment Graph, please refer to the Environment Graph section.

- Populate the configuration form with the following details:
- Trigger Event: Select
Before Insertor another event that should fire the trigger. - Records Split Strategy: Select
Custom. - Records Split Strategy Class: Click the Plus Icon to add new Apex Class.
If you haven’t created a Salesforce Trigger yet click the Generate Trigger Code button.
ℹ️ For more information about Generate Trigger Code button refer to the Triggers Configuration section.

- Paste following code into the Class section.
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 the previous status was different than 'Closed'
Boolean wasNotClosedBefore = (oldCase.Status != 'Closed');
// The record will be processed only if both conditions are met
return isNowClosed && wasNotClosedBefore;
}
}- Paste following code into the Test class section.
@IsTest
private class ClosedCaseSplitStrategyTest {
@IsTest
static void testStrategyConditions() {
ClosedCaseSplitStrategy strategy = new ClosedCaseSplitStrategy();
// Status changed to 'Closed' -> TRUE
System.assertEquals(true, strategy.canProcess(new Case(Status = 'Closed'), new Case(Status = 'In Progress')));
// Updating a record that was already 'Closed' (e.g. editing another field) -> FALSE
System.assertEquals(false, strategy.canProcess(new Case(Status = 'Closed'), new Case(Status = 'Closed')));
}
}- Click Deploy.

-
Select the
ClosedCaseSplitStrategyclass that you just deployed. -
Click Save.
Step 2: Create a Step for the first Record Type
- In the Breezz Environment Graph click the Action Icon o the Step Group.
![]()
- Select Create Step.

- Populate the configuration form with the following details:
- Parent Group: Provide a name for the step.
- Description: Provide a brief description of the step.
- Entry Criteria: Select
Resolution Notescustom field andIs Not Set. - Action Configuration: Select
Custom Validation. - Choose From: Choose
Plaint Text. - Error Message: Provide an error message, eg.
You cannot close this Case without entering Resolution Notes. Please fill out the field and try again..
- Leave the rest as it is and click Save.
Step 3: Verify the result
- Create a Case with any data and leave the Resolution Notes field empty.
- Try to close this Case to see the custom error message.
