Apr 16, 2025

Best Practices for Optimizing Salesforce System Performance and Scalability

Introduction:

Salesforce is a powerful cloud-based platform designed to streamline and automate business processes across various domains. Features such as Flows, Triggers, Product and Price Rules in Salesforce CPQ, and Invoice Schedulers in Salesforce Billing enable organizations to improve efficiency and enforce business logic at scale.

However, over time, without proper maintenance and adherence to best practices, Salesforce environments can experience performance degradation. Users may face long transaction save times, sluggish system responses, or even timeouts, issues that are exacerbated when working with managed packages like Salesforce CPQ and Billing, which add additional computational complexity.

With the introduction of Salesforce Revenue Lifecycle Management (RLM), CPQ and Billing functionalities will transition to core Salesforce objects, improving system performance and scalability. This article explores best practices for proactively maintaining optimal system performance while offering specific strategies for enhancing Salesforce CPQ environments.


Common Symptoms of Performance Issues

  • Prolonged save times on Quote, Opportunity, or Order

  • High flow or Apex execution times

  • Frequent governor limit violations (CPU, SOQL, heap)

  • CPQ Quote Calculator lag and timeouts

  • Record locking or deadlocks during batch operations


Proactive Approaches for Performance Optimization

A well-maintained Salesforce system requires a proactive approach to prevent inefficiencies from creeping in. The following strategies can help organizations optimize their Salesforce environment before performance issues arise.

  1. General Best Practices

  • Minimize Object-Level Automations:
    Instead of creating multiple Flows per object, consolidate them into two well-structured Flows:

    • Before Save Flow: Optimized for quick data validations and record modifications.

    • After Save Flow: Designed for operations that require interactions with related records or external systems.
      Reducing the number of automations per object decreases processing time and improves maintainability.

      Example of a salesforce consolidated After Save flow created on the Opportunity object

      Example of a salesforce consolidated Before Save flow created on the Opportunity object

  • Avoid Excessive Triggers and Flows on High-Traffic Objects:
    Objects with frequent record updates, such as Opportunity, Account, and Case, should not be overloaded with multiple automations. Too many synchronous processes can slow down transactions and create race conditions.

  • Leverage Event Monitoring for Performance Tracking:
    Salesforce Event Monitoring allows organizations to track API usage, Flow execution times, and transaction performance. Regularly reviewing these insights can help pinpoint automation bottlenecks before they become critical issues.


  • Robust Error Handling Strategies

Proper error handling is often overlooked but is essential for maintaining a resilient and scalable Salesforce system. Unhandled exceptions can cause incomplete transactions, data inconsistencies, or degraded user experience — especially in complex environments like Salesforce CPQ where multiple processes and integrations are interdependent.

To ensure that errors are managed gracefully and transparently, organizations should adopt the following error-handling strategies:


  • Implement Fault Paths for Critical Actions

All automation elements that involve DML operations (such as record creation, update, or deletion), email sends, or external callouts should have defined fault paths. In Flows, this means explicitly handling the Fault Connector to catch and manage exceptions rather than allowing them to surface to the end user. Fault paths should log relevant information (e.g., record IDs, error messages, user context) to support troubleshooting.

Example of using Fault Path Exception in Salesforce Flows

  • Use a Centralized Exception Logging Mechanism

To track errors systematically, it's recommended to create a custom Exception Log object. This object should capture metadata about the failed transaction, including:

  • The type of operation (e.g., DML, API call, email send)

  • The originating automation or process

  • The exact error message

  • A timestamp and the user initiating the process

This approach enables administrators and developers to review patterns of failure, prioritize remediation, and provide accountability across development teams.

  • Modularize Error Handling with Sub-flows

To avoid duplicating logic across multiple automations, build a reusable subflow dedicated to error handling. This subflow can take inputs such as the error message, source flow name, and record ID, and then log the error to the Exception Log or send an alert. This modular approach enhances maintainability, promotes reuse, and ensures consistency in how errors are managed across the org.

Example of Salesforce Error Handling Sub-flow 

  • Build Dashboards to Monitor Exception Patterns

Once exception logging is in place, organizations should develop Exceptions monitoring dashboards to track and visualize recurring issues. These dashboards can be filtered by error type, object, or impacted business process. Some common patterns worth tracking include:

  • Null object references

  • Missing Master Data records

  • Missing Critical Data

  • Failures in records generation or sync

  • Record locking or validation rule violations

  • Exceptions related to Salesforce Governor Limits such as CPU time limit exceeded or SOQL query limits.

Example of Salesforce Exception Monitoring Dashboard

Having these visual insights enables proactive mitigation, helps prioritize technical debt, and informs sprint planning by highlighting areas of instability or poor data quality.

  1. Salesforce CPQ-Specific Considerations

Salesforce CPQ presents unique challenges due to its dependency on complex calculations, interrelated pricing rules, and large quote processing. Organizations must carefully manage their CPQ configurations to ensure scalability.

  • Avoid Triggers and Flows on CPQ Objects:
    Native Salesforce CPQ automation already applies significant processing overhead during quote calculations. Introducing custom triggers or Flows on objects such as Quote, Quote Line, or Quote Line Group can significantly slow down performance. Instead, use declarative tools like Price Rules or the Quote Calculator Plugin (QCP) for business logic execution.

  • Prioritize Feature and Option Constraints Over Product Rules:

    • When possible, use Feature Constraints and Option Constraints instead of Product Rules for conditional configurations.

    • A combination of Dynamic Bundles and Option Constraints can reduce the need for complex Product Rules, leading to improved performance.

  • Optimize Pricing Logic with QCP and Price Rules:

    • The QCP enables more efficient execution of price calculations, particularly for complex pricing models.

    • Combine Product Rules and Price Rules that share similar conditions to minimize redundant executions.

  • Efficient Handling of Large Quotes:
    Large quotes with hundreds of line items require additional performance considerations. Optimizing CPQ package settings can significantly improve processing speeds:

    • Enable Large Configuration Mode to handle complex bundles.

    • Adjust Large Quote Threshold settings slightly below the expected quote size to ensure smooth performance.

    • Fine-tune the Quote Batch Size for optimal transaction processing.

      Screenshot of Salesforce CPQ Package Settings - Line Editor

      Screenshot of Salesforce CPQ Package Settings – Additional Settings

By following these best practices, organizations can ensure that their Salesforce CPQ system remains responsive and scalable, even in high-volume environments.


Fixing Performance Issues in Impacted Orgs

For organizations experiencing performance bottlenecks, the following structured approach can help restore efficiency and scalability.

Step 1: Assess Existing Automations

Conduct a full inventory of all existing automations, including:

  • Flows, Triggers, and Process Builders

  • Scheduled Jobs and Batch Processes

  • Custom Apex Code

Use Salesforce Debug Logs and Event Monitoring to measure execution times of your end to end  Q2C triggers and identify the most resource-intensive processes.

Example of Salesforce Triggers Execution Time Report 


Step 2: Engage with Business Stakeholders

Many automations become obsolete as business needs evolve. Conduct workshops with business users to evaluate which automations are still relevant and which can be retired.


Step 3: Refactor and Consolidate Automations

  • Migrate outdated Process Builders to Flows, as Process Builder is being phased out by Salesforce.

  • Consolidate Flows and Triggers into structured "Before Save" and "After Save" logic per object.

  • Optimize Scheduled Jobs to reduce unnecessary batch executions.


Step 4: Review CPQ-Specific Features

For organizations using Salesforce CPQ, a targeted review of CPQ configurations is essential. Consider:

  • Retiring redundant Price Rules, Product Rules, Lookup Queries, and Search Filters.

  • Streamlining pricing logic by optimizing rule sequence and merging similar conditions.

  • Running performance tests on quotes of varying sizes to assess system behavior under load. One of the tools we can use for this analysis is Visual studio’s Apex Log Analyzer extension.

Screenshot from VS Apex Log Analyzer for a save transaction of quote with 20 Quote Lines

Screenshot from VS Apex Log Analyzer for a save transaction of quote with 50 Quote Lines

By implementing these steps, organizations can significantly enhance Salesforce's responsiveness and stability.


Conclusion: Governance and Long-Term Scalability

Beyond technical optimizations, organizations must establish a Salesforce technical governance framework to ensure long-term system stability. Governance provides a structured approach to managing customization, enforcing best practices, and balancing business needs with technical constraints.

A well-defined Salesforce Technical Governance Model should include:

  • Standardized Development Practices: Establish clear guidelines for Apex development, Flow creation, and configuration management.

  • Code Review & Approval Processes: Implement version control and peer review workflows to ensure high-quality code deployments.

  • Automation Strategy per Object: Define a standardized approach for Flows, Triggers, and other automation tools to avoid conflicts and inefficiencies.

  • Parallel Development Transparency: Create visibility across teams to prevent duplicate efforts and ensure seamless integration of new features.

By proactively managing system complexity and continuously refining development strategies, organizations can maintain a high-performing, scalable Salesforce environment that adapts to evolving business demands.

© 2025 All rights reserved