Skip to content

Instantly share code, notes, and snippets.

@aidan-harding
Created July 22, 2022 06:58
Show Gist options
  • Save aidan-harding/6b03f7f377119f3825781c10d018629b to your computer and use it in GitHub Desktop.
Save aidan-harding/6b03f7f377119f3825781c10d018629b to your computer and use it in GitHub Desktop.
Lambda-like class with lots of casting
private class IsYearChanged extends nebc.TriggerContextBooleanFunction {
public override Boolean isTrueFor(SObject oldRecord, SObject newRecord) {
Term__c oldTerm = (Term__c)oldRecord;
Term__c newTerm = (Term__c)newRecord;
return Math.abs(oldTerm.Start_Date__c.year() - newTerm.Start_Date__c.year()) > 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment