Skip to main content

Learn About Data Optimization

Learning Objectives

After completing this unit, you’ll be able to:

  • Explain how to optimize data structures in Spiff Designer.
  • Simplify calculations to enhance processing speed.
  • Describe the best practices for using filters, calculations, and functions.

Why Performance Optimization Matters

Speed and performance are crucial when working with complex incentive structures. Poorly optimized data leads to slow calculations, delays in processing payouts, and a frustrating user experience. Optimizing data structures ensures faster calculation times for real-time reporting and payouts, and improved system performance during peak usage. An optimized data structure also lowers risk of errors caused by unnecessary complexity.

Next, explore key strategies for improving performance by simplifying data structures and understanding the impact of filters, functions, and calculation logic on performance.

Prioritize Data Filter Logic for Efficiency

Filters are essential for narrowing down data filters, but their arrangement can significantly affect processing speed. Consider these fixes.

  • Place largest filters first: When combining multiple filters, place the largest or most restrictive filters first in the logic. Spiff processes filters sequentially. By eliminating as many records as possible in your first filter, you reduce the amount of data processed by subsequent filters.
    As an example, let’s say you want to optimize a ClosedByRepInPeriod data filter. You’re using a ClosedWon filter, an InPeriod filter, and a ByRep filter. Among these three filters, which one do you list first that eliminates the largest number of records from your data source? That’s InPeriod! ClosedWon returns records for all users and periods that are closed and won. ByRep returns fewer records, but shows all records closed by a single rep. If a sales rep has been in the company for years, the ByRep filter returns a lot of data. By starting with an InPeriod filter, you’re only considering records for a single month or quarter. After filtering records for the current period, Spiff filters by rep and closed or won deals much faster.
    The ClosedInPeriod data filter with optimized sub-filters.
  • Avoid overlapping filters: Ensure filters are distinct to prevent redundant data elimination.
  • Document filters: Use comments or notes to explain the purpose and logic behind each filter during troubleshooting.

The Trace Function

The trace() function is invaluable for debugging and giving visibility for reps on their statements, but it can slow down calculations if you use it excessively or in complicated payout calculations.

Use these recommendations to speed up calculations using the trace() function.

  • Use sparingly: Include trace statements for calculations you want your reps to see. Remove or disable them with complicated let() or contains() functions.
  • Focus on key calculations: Trace the critical parts of the calculation where issues occur. Trace is also useful for calculations that reps prefer to check their payouts. Avoid excessive use of trace on complicated filters or calculations that aren’t important for payouts.

The Contains Function

The contains() function is useful for checking whether specific values exist in a data filter but is computationally intense. Remember these best practices when using the function.

  • Minimize usage: Avoid using the contains() function where other filter methods or direct comparisons are possible.
  • Use more payout rules: Let’s say an admin uses a single data filter for two groups of reps. They use the contains() function to filter records for each group based on their commission criteria. It’s more data efficient to create two payout rules, and a data filter for each rule that returns the appropriate data set.
  • Test for performance: Run calculations with and without contains() to measure its impact on performance.

The Let Function

Use the let() function for custom accumulations, but keep in mind that it can impact performance if overused or misapplied. Use these best practices to get the most out of the function.

  • Simplify the definitions: Define only the necessary variables. Avoid nesting multiple let() statements.
  • Reuse variables judiciously: Use let() for calculations that repeat multiple times to reduce redundancy.
  • Test alternative approaches: For simple calculations, consider using the Accumulator function built within Designer. Sometimes, this function is faster than defining variables with let().

Conclusion

Congratulations! You know now how effective data management in Spiff Designer is crucial for accurate commission calculations, maintaining trust, and optimizing workflows. Use this invaluable knowledge to organize plans for clarity, accurate payouts, and streamlined updates in your business. Good luck!

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback