UTIL_FormulaContext.LeadContext
Class
apex
global inherited sharing class UTIL_FormulaContext.LeadContext implements UTIL_FormulaFilter.INT_SObjectFormulaEvaluationContextImplements: UTIL_FormulaFilter.INT_SObjectFormulaEvaluationContext
Formula evaluation context for Lead object. Provides typed access to Lead records in formula evaluations. Auto-detected by Trigger Action Framework when EntryCriteriaContextClassName__c is blank. Can also be used directly in custom Apex. Formula Variable Names: oldRecord, newRecord
Since: 1.0
Example:
apex
// Trigger Action Framework formulas:
// newRecord.Status = "Working"
// newRecord.LeadSource <> oldRecord.LeadSource
// Direct Apex usage:
FormulaEval.FormulaInstance formula = Formula.builder()
.withFormula('newRecord.IsConverted = false && newRecord.Status = "Qualified"')
.withReturnType(FormulaEval.FormulaReturnType.BOOLEAN)
.withType(UTIL_FormulaContext.LeadContext.class)
.build();
UTIL_FormulaContext.LeadContext context = new UTIL_FormulaContext.LeadContext();
context.setContext(null, lead); // null = no old record (insert scenario)
Boolean matches = (Boolean)formula.evaluate(context);See Also: UTIL_FormulaFilter.INT_SObjectFormulaEvaluationContext
Fields
| Field | Description |
|---|---|
| global Lead newRecord | Lead record state AFTER DML (null on delete). |
| global Lead oldRecord | Lead record state BEFORE DML (null on insert). |
Field Details
newRecord
apex
global Lead newRecordType: Lead
Lead record state AFTER DML (null on delete).
Since: 1.0
Example:
apex
Lead value = instance.newRecord;oldRecord
apex
global Lead oldRecordType: Lead
Lead record state BEFORE DML (null on insert).
Since: 1.0
Example:
apex
Lead value = instance.oldRecord;