Quick Glance.
Salesforce CPQ can struggle with performance and synchronization issues when dealing with large quotes. This custom design addresses these challenges by distributing the workload across custom objects, leveraging asynchronous processing, and implementing a modular approach. By breaking down large quotes into smaller, more manageable chunks and utilizing efficient processing methods, this solution streamlines the quoting process for businesses with complex product offerings and high-volume sales. In this blog, readers will gain actionable insights into overcoming CPQ limitations, improving performance, and enhancing scalability for large quotes.
Salesforce CPQ (Configure, Price, Quote) is a powerful tool designed to streamline the process of creating quotes for complex products and services. However, creating and managing large quotes in Salesforce CPQ can be complex as it can lead to following intermittent issues:
- Performance Issues: Handling many quote lines or complex product configurations can lead to performance issues, such as slow loading times or delays in data processing. Performance issues can negatively impact the user experience, making it cumbersome for sales reps to navigate and manage large quotes efficiently
- Synchronization Issues: Large quotes with many lines can lead to synchronization issues, particularly if there are multiple integrations or custom processes in place.
- User Experience: Performance issues can negatively impact the user experience, making it cumbersome for sales reps to navigate and manage large quotes efficiently.
- Template Complexity: Designing quote templates that can handle large and complex quotes while maintaining clarity and professionalism can be challenging.
- Compatibility: Ensuring compatibility between Salesforce CPQ and other integrated systems can be challenging, particularly if the integrations are complex or involve large data sets.
Resources:
If Large quote is enabled, then according to official documentation, development teams need to set large quote threshold because sometimes quote processes can hit governor limits. If processes are being reconfigured, then large quote threshold needs to be adjusted accordingly, but this step is purely hit, and trial and it might behave differently in production and sandbox. Also, there can be multiple situations where a single product bundle can have more than 200 to 300 products which may be problematic even after reducing large quote threshold.
CPQ is solely for configuring, pricing and quoting but the revenue and billing calculation may cause problems if large quotes are used. So, to handle revenue, following ways can be utilized:
- One such method for calculation of revenue is by using revenue cloud but currently revenue cloud only supports maximum of 300 quote lines under a single quote, this means that handling large sales can be tough and may need customization.
https://help.salesforce.com/s/articleView?id=sf.qocal_limits.htm&type=5
https://help.salesforce.com/s/articleView?id=sf.qocal_large_transactions_pilot.htm&type=5
- Another way for revenue handling is by using addon billing package but it also comes with practical limits of 200 to 300 quote line under a single quote.
Several users have also reported performance degradation of CPQ while using large datasets on SF Idea exchange.
- To overcome these limitations, we can use the following design to handle thousands of quote lines under a single quote.
Overview: This technical design uses some custom objects along with the standard objects like Opportunity, Quote, Order, Invoices etc. These objects are created to distribute the load in system, streamline the ordering process using asynchronous apex, platform events and flows. Following objects were created:
- Deal –> This custom object is meant to establish connection between an opportunity and quote. The deal contains linkages to account, quotes, quote lines, contracts, orders etc. Deal also acts as a central point for amendment, renewal, trials.
- Deal locations -> The object relates to deal using a master detail relationship. The deal location is created to segregate the quotes related to an opportunity based on year and shipping locations.
- Deal location lines -> This object acts as a substitute for quote lines and are linked to deal locations using a lookup relationship.
- Orchestration -> This object is created to store various stages of deal process which includes order generation, quoting, pricing of orders, revenue schedule generation, invoicing & contracting.
Relationships/considerations:
- Deal acts as an umbrella for all the quote related to an opportunity. It is designed to store the cumulative revenue data, dates related to engagement, approvers, contract information and many other information.
- Deal location is related to deal via a master detail relationship. Deal location act as a proxy for quote and segregates the quote lines based on the year and shipping location. Deal location can be considered as a parent through which all the quote related calculations will be coordinated.
- Product configuration, discount schedules, pricing of product is done using standard salesforce CPQ procedures.
- Lookalike of Quote line editor is made on Deal location using custom LWC. This LWC is used to add the product, adjust pricing, discounts, quantity, define dates, year in which products are sold, shipping locations, nature of sale etc. This also incorporates guided selling and functionality to add package products
- When products are added using custom quote line editor (Deal location configurator), a Deal location line record is created which acts as a proxy for quote lines. This object relates to quote line, revenue objects to handle pricing.
- Automations using queue apex & platform events, are implemented in custom QLE to synchronize the pricing in deal location line as well as for creation of quotes.
- Orchestration object is used as an intermediatory for storing the stage of processes.
General procedure for creation and posting of quote:
Sync process uses the capability of queueable apex, and it will create one quote per 200 quote lines. There can be multiple quotes for a deal location, so in our model standard cpq quote object is used for utilizing OOTB functionality of salesforce related to ordering, contracting and invoicing but the actual quote will be sent to customer through the deal location record. The sync process is invoked on the click of lightning button which will be present in custom deal location configurator.
Steps followed for posting quote related to new deal:
- Creation of opportunity based on prospects received from the sales & marketing team.
- Creation of deal under an opportunity, we can modify the fields on deal according to the project requirements but in general it stores the data related to engagement.
- Creation of deal locations under the deal. Initially, deal location will be created and configured for Year 1 sale. After Year 1 Deal location is configured properly with products, pricing and other things, it is synced, and quote is created.
- In Step 3, Quote creation process is achieved using queueable apex (As we are targeting for handling large number of QL’s). One more reason for using queueable apex is that it runs in near synchronous way.
- The deal location for further years like Year 2, Year 3 ... is created by cloning the Year 1 Deal location. Cloning is achieved using queueable apex and is invoked on click of a lightning button. The different stages of cloning and its progress can be tracked using orchestration object. Benefits of cloning an earlier deal location is that the user can use existing product configuration if they want to sell the same products in further years or they can modify existing configuration. This reduces the workload of creating duplicate data. Quote creation process for this new deal location executes in the same way as previous year deal location. (b – in process image)
- Deal is sent for approval and after approval, ordering process is initiated (Refer below diagram for ordering automation).
Ordering & Contracting Automation: This can be invoked as soon as deal is approved, the steps will be a set of schedulable and batch apex which will run in sequence according to the stages recorded in the orchestration object. (d – in process image)
Steps can be segregated as follows:
- Linkage creation stage – This step is utilized for creating linkages between products being sold in different years and this is done to achieve revenue calculation, adjustments related to customer prospects & discounting, quantity management, reporting, analytics etc. This linkage is based on the year and location to which a product is being sold. The steps in this stage are:
- This process is invoked straight after deal approval, after deal approval platform event is published.
- The platform event published in Step (a) will in turn invoke a batch apex from its trigger to handle large amount of data updates.
- After all the record updates are performed, In the finish method of batch apex, orchestration stage will be updated.
- Revenue updates stage/Order creation – This stage is utilized for creating orders and making updates on revenue recognition fields. Revenue fields will be utilized further for invoicing, contracting and for various other steps. This stage is only for creation of order/ order products, one order will be created per quote and those will be mapped under the deal location. Updates to order products is separated out in another stage. This step is achieved using platform event, schedulable and batch apex. Steps involved in this stage are:
- A scheduled apex class is configured to execute every 15 minutes to check all the orchestration records whose status satisfies the requirement.
- If there are any orchestration that satisfies the requirement, then all the deals related to it is processed in a batch apex.
- In the execute method of batch apex, separate platform events are created and published for each quote.
- Now, after PE’s are published the order creation DML is performed in the trigger of platform event. Separate platform event is published for each quote to segregate the transactions.
- After all the quotes are ordered, status of orchestration is updated.
- Order products update – This stage is used for updates related to order product. Some of the common updates is related to how subscription will be invoiced, how revenues will be collected etc. This is implemented using batch apex that is invoked straight after stage of orchestration is updated in the previous step (2).
- Contracting and revenue generation – In this stage, functionalities related to generation of contracts is present. Contract is generated on per order basis and cumulative calculation of all contracts happens on deal level. Final contract is generated on deal and shared with customer. This is generated using platform events and triggers. Platform event is published in orchestration object’s trigger for each order related to a deal. Then in platform event’s trigger the contracting is achieved.
Conclusion
This blog outlined a custom design approach for managing large quotes with thousands of lines in Salesforce CPQ. By leveraging custom objects, asynchronous Apex, platform events, and workflows, the solution distributes workload, streamlines ordering processes, and overcomes limitations associated with standard CPQ functionality for large datasets. Key takeaways include:
- Distributing Load: Custom objects like Deal and Deal Location segregate quotes and product configurations, improving performance.
- Asynchronous Processing: Queueable Apex and batch/schedulable Apex handle data processing efficiently, avoiding governor limits.
- Modular Design: Order creation, revenue calculation, contracting, and order updates occur in separate stages, enabling better control and scalability.
- Improved User Experience: Custom LWC mimics the CPQ quote line editor for user familiarity.
This custom design offers a potential solution for organizations needing to manage large, complex quotes within Salesforce CPQ. For further implementation details, consider consulting with a Salesforce development expert.
![Anupam Tripathi](https://www.coforge.com/hs-fs/hubfs/anupam%20mani%20tripathi.jpg?width=90&height=90&name=anupam%20mani%20tripathi.jpg)
Anupam possesses over 17.5 years of comprehensive industry experience in the CRM domain. He holds 20 Salesforce certifications and is certified in Copado. He is adept at business analysis, architectural design, customization, administration, deployment, and the management of end-to-end Salesforce projects. He has executed over 16 projects for small and mid-sized businesses, which included rapid development initiatives, as well as five comprehensive implementations that utilized Service Cloud, Sales Cloud, Community Cloud, Force.com, and Marketing Cloud solutions.
Related reads.
About Coforge.
We are a global digital services and solutions provider, who leverage emerging technologies and deep domain expertise to deliver real-world business impact for our clients. A focus on very select industries, a detailed understanding of the underlying processes of those industries, and partnerships with leading platforms provide us with a distinct perspective. We lead with our product engineering approach and leverage Cloud, Data, Integration, and Automation technologies to transform client businesses into intelligent, high-growth enterprises. Our proprietary platforms power critical business processes across our core verticals. We are located in 23 countries with 30 delivery centers across nine countries.