Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
FormulaRecalcResult Class
Namespace
Usage
Indicates the result and status of recalculating formulas on a single sObject. Holds a reference to the sObject and a list of all the fields that were recalculated.
Example
This example assumes that you have a formula field called divide__c with formula “1 / LEN(Name).
1List<Account> accounts = [SELECT Name FROM Account WHERE Name='Acme'];
2accounts[0].Name = '';
3List<FormulaRecalcResult> results = Formula.recalculateFormulas(accounts);
4FormulaRecalcResult result0 = results[0];
5FormulaRecalcFieldError fieldError = result0.getErrors()[0];
6System.debug(fieldError.getFieldName()); // 'divide'
7System.debug(fieldError.getFieldError()); // 'Division by zero'FormulaRecalcResult Methods
The following are methods for FormulaRecalcResult.
getErrors()
Signature
public List<System.FormulaRecalcFieldError> getErrors()
Return Value
Type: List<FormulaRecalcFieldError Class>
isSuccess()
Signature
public Boolean isSuccess()
Return Value
Type: Boolean