Salesforce Fact #854 | recalculateFormulas() count towards SOQL query count
We have the recalculateFormulas() function of Formula class which can evaluate the formula without saving the sobject record and this is super helpful in test classes.
An interesting thing is, when the sobject record contains all the fields which are needed for the formula evaluation, then Formula.recalculateFormulas() does not count towards the total SOQL query count. But, if the sobject record does not have any of the field which is needed for the formula evaluation, the recalculateFormulas() call is counted as 1 SOQL query.
In this example, we have two number fields, Test_Runs and ODI_Runs and a formula field, Total_Runs which is the sum of ODI and Test runs.
Attached are the screenshots.
Comments
Post a Comment