IsLessThan to support comparison betweens 2 SObject fields
Opened this issue · 0 comments
nebc-jasonfung commented
Currently, when comparing 2 SObject fields it will throw a TypeException, see the example below:
new nebc.LazyTriggerContextPairIterator(oldList, newList)
.filterT(new nebc.IsFieldChangedInTrigger(SObject.SomeField))
.newRecords()
.filterT(new nebc.IsLessThan(SObject.PercentLeft, SObject.PercentRight)) // System.TypeException
.put(...)
.forEach();
We can add a new constructor to IsLessThan to support this sort of comparison:
global IsLessThan(SObjectField left, SObjectField right) {
functions = new FunctionList(new FieldFromSObject(left), new FieldFromSObject(right));
}