Avoid Re-Calculations

Set the Right Scope

Sometimes a logic (e.g., CFS or Analytics calculation) calculates over and over records which do not change. If a record needs to be calculated only once, it can be marked with some flag and a subsequent calculation should exclude records with this flag. 

The first element of the logic:

if (api.currentItem('AlreadyProcessedByCFS') as Boolean) { api.abortCalculation() return }

AlreadyProcessedByCFS.groovy:

return true

Alternatively, when you configure the CFS, specify a filter for the AlreadyProcessedByCFS column, and filter out those items where the value is “true”:

Multiple Passes

If you call api.markItemDirty() on an item, it is generally good to in the beginning of the logic and also call api.abortCalculation() afterwards.

 

Found an issue in documentation? Write to us.