UTIL_FormulaContext.ApiIssueContext
Class · Group: Utilities
Learn it: Validation guide
global inherited sharing class UTIL_FormulaContext.ApiIssueContext implements UTIL_FormulaFilter.INT_SObjectFormulaEvaluationContextImplements: UTIL_FormulaFilter.INT_SObjectFormulaEvaluationContext
Formula evaluation context for ApiIssue__c records, the records that log each failed API call. A context class is the class that gives a formula its values. This one gives a formula the API issue record before and after the save, so a trigger action on ApiIssue__c can use an entry formula. The Trigger Action Framework finds this class by itself when EntryCriteriaContextClassName__c is blank. You can also use it directly in your own Apex. Formula Variable Names: oldRecord, newRecord
Example
// Trigger Action Framework formulas:
// TEXT(newRecord.Status__c) = "Open"
// TEXT(newRecord.Status__c) <> TEXT(oldRecord.Status__c)
// Direct Apex usage:
FormulaEval.FormulaInstance formula = Formula.builder()
.withFormula('newRecord.ServiceName__c = \'MyService\'')
.withReturnType(FormulaEval.FormulaReturnType.BOOLEAN)
.withType(UTIL_FormulaContext.ApiIssueContext.class)
.build();
UTIL_FormulaContext.ApiIssueContext context = new UTIL_FormulaContext.ApiIssueContext();
context.setContext(null, apiIssue); // null = no old record (insert scenario)
Boolean matches = (Boolean)formula.evaluate(context);See Also: UTIL_FormulaFilter.INT_SObjectFormulaEvaluationContext
Fields
| Field | Description |
|---|---|
| global ApiIssue__c newRecord | ApiIssue__c record state AFTER DML (null on delete). |
| global ApiIssue__c oldRecord | ApiIssue__c record state BEFORE DML (null on insert). |
newRecord
global ApiIssue__c newRecordType: ApiIssue__c
ApiIssue__c record state AFTER DML (null on delete).
Example
ApiIssue__c value = instance.newRecord;oldRecord
global ApiIssue__c oldRecordType: ApiIssue__c
ApiIssue__c record state BEFORE DML (null on insert).
Example
ApiIssue__c value = instance.oldRecord;