Best Practices for Managing Memory in Salesforce Spiff Statements

Calculation delays occur when the Salesforce Spiff takes too long to process a requested action. Statement processing can time out with errors, which are often related to large data filters, complex plan design, and inefficient rule structures.

Required Editions

Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience
Available in: Enterprise, Unlimited, and Developer Editions
Available for an additional cost in: Professional Edition with Web Services API Enabled

The statement size limit is 35 MB, or about 5,000 obligations. The maximum number of obligations varies depending on the number of rows and columns in the obligations.

To help reduce memory usage, consider these options when creating commission plans.

Rules

Optimize rule structures. Look for opportunities to simplify your compensation plan rules. Avoid unnecessary calculations or unnecessary dependencies that are contributing to processing times.

To resolve statement timeouts, first create another plan. Then, move payout rules with a large number of rows and columns of data from one statement to the new plan. This approach shares the data loading burden across multiple statements.

Filters

Enhance data filter efficiency through strategic reordering. Prioritize the most important and simple filters first. Save complex operations such as the contain function, double filters, and relationships for the end of the data filter.

Calculations

Identify calculations that can be encapsulated to improve efficiency.

Connectors

Get rid of unused connector fields from the logic or statement.

Identify deal-level calculations that you can convert to summary calculations.

Overwrites

Check for plan overwrites. Overwrites can cause unexpected delays when they interfere with downstream rules. Use overwrites sparingly, and make sure that overwrites aren't causing longer processing times.

Note
Note Spiff doesn't support overwriting data in statements that exceed 35 MB.

Tracing

Turn off tracing for accumulated variables, relationships, double filters, and other QTD or YTD calculations as they generate a large amount of trace data. Turn off tracing for any unnecessary calculations for front-end statements or reporting purposes.

Trace-related issues can occur when a summary calculation appears in multiple locations within a formula and the calculation is visible for the statement card. To mitigate these issues, consider creating an untraced field, which references the original traced field.

StatementCalculatedField_Untraced references StatementCalculatedField

Usually, you use the untraced field and reserve the traced field for a single location. This approach ensures the statement's display while minimizing trace overhead for other uses of the field.