Problem statement

The client required an efficient and scalable pricing engine integrated into the Salesforce platform. They wanted to dynamically adjust prices based on market demand, discounts, price lists, different price books, and customer segmentation. Manual price adjustments were time-consuming and prone to errors, so the client needed an automated solution to optimise their pricing strategies. The goal was to derive an “effective price per piece” after applying two layers of discounts to the “actual price per piece” calculated from the “total product quantity” for various customer types (B2B, B2C, walk-in customer). A customised quote PDF had to be generated and sent to customers

Detailed use case

The client’s customers were categorised into three groups

  1. B2B customers, 
  2. B2C customers, 
  3. Store pick/walk-ins.

The client provided two layers of discounts on the products

  • Offered Discount: A one-time discount on the price per piece.
  • Discount per slab: A dynamic discount percentage is applied at each slab, where the slab size could also be dynamic.

Let’s take an example

Let’s consider a B2B customer with a price per piece of INR 7 and a total product quantity of 640,000. The slab size is set at 100,000. The offered discount is 5%, and the discount per slab is 6%.

  • Customer: B2B
  • Price per piece: INR 7/-
  • Total product quantity: 6,40,000
  • Slab: 1,00,000 (each 1,00,000 of the total product quantity becomes a slab).
  • Offered Discount: 5.0%
  • Discount per slab: 6.0%
  • Effective Piece Per Piece: To be derived after applying the Offered Discount and Discount Per Slab.

Wonder how the effective piece per piece is derived now?

For the sake of explanation, let’s take a variable named “Iterative Price per Piece.”.

  • First Layer of Discount: Apply the offered discount (5% in this case). The iterative price per piece becomes $6.65.
  • Second Layer of Discount: Apply the discount per slab (6% in this case). There will be seven slabs since the total product quantity is 640,000 and the slab size is 100,000. 

The total number of slabs will be 7.

Each slab will have a specific discount percentage.

The table below demonstrates how the discount per slab is applied to each slab

Iteration Total QuantitySlabDiscount per slabIterative Price per pieceAmount Per Slab
16,40,0000–1,00,0006.0%6.0% of 6.65 = 6.251,00,000 * 6.25 = 6,25,000
26,40,0001,00,000–2,00,0006.0%6.0% of 6.25 = 5.871,00,000 * 5.87 = 5,87,000 
36,40,0002,00,000–3,00,0006.0%6.0% of 5.87 = 5.51 1,00,000 * 5.51 = 5,51,000
46,40,0003,00,000–4,00,0006.0%6.0% of 5.51 = 5.171,00,000 * 5.17 = 5,17,000 
56,40,0004,00,000–5,00,0006.0%6.0% of 5.17 = 4.851,00,000 * 4.85 = 4,85,000
66,40,0005,00,000–6,00,0006.0%6.0% of 4.85 = 4.551,00,000 * 4.55 = 4,55,000 
76,40,0006,00,000–6,40,0006.0%6.0% of 4.55 = 4.27    40,000 * 4.27 = 170,800

Total Amount Payable = Sum of all “Amount per Slab,” which will be 33,90,000 INR/-

Flow diagram

Learn how to build an efficient and scalable pricing engine in Salesforce to automate pricing adjustments and optimize your strategies.

Why was it not achievable via the standard Sales Cloud?

While Salesforce offers a robust CRM platform, it does not provide an out-of-the-box dynamic pricing engine in the Sales Cloud. The typical sales cloud primarily focuses on customer relationship management, sales automation, and, to some extent, marketing functionalities. Therefore, the client needed a custom solution tailored to their dynamic pricing requirements.

Two limitations of the sales cloud led the client to seek a custom dynamic pricing solution

  • Lack of a discounting mechanism
  • Lack of a mechanism to handle dynamic pricing slab-wise

What custom solution is provided?

The custom solution provided to the client’s sales team involved building a dynamic pricing engine within the Salesforce platform. It included the development of custom components, integration with data sources, and the implementation of pricing algorithms and rule-based strategies.

The custom solution included the following features

  • Data Integration: The engine integrated with various data sources, such as sales data, customer data, price list items, and average selling prices, to provide accurate and timely pricing recommendations.
  • Rule-Based Pricing: The engine implemented rule-based pricing strategies to dynamically adjust prices based on predefined rules, such as volume discounts, specific categories, and customer segment-specific pricing.
  • Real-Time Pricing Adjustments: The engine allowed for real-time pricing adjustments, ensuring that prices were updated based on market demand, inventory levels, and competitor activities.

The dynamic price engine process can be categorised into two parts

Part 1 – Setting up Master Data

  • Product and Pricebook is used to set up clients’ products end-customer segmentation-wise.
Product 
Name ABC
Product CodeABC-001
FamilyFamily A
CategoryXYZ
IndustryFashion
  • Leverage a custom object named “Price List” to handle all the dynamic prices, slabs, and discounts.
Price List Item 
ProductLookup to product
Discount per slab6%
B2C Actual Price Per Piece 7
B2B Actual Price Per Piece 5
Store pick Actual Price Per Piece 10
Slab100000

Part 2 – Generate a Quote PDF after Dynamic Pricing Calculation

  • Provide the “Generate Quote” button on the Opportunity record.
  • On clicking the “Generate Button,” Screen Flow should open.
  • On screen flow, display “Offered Discount” –> Click Next.
  • Show the “Price the Piece” value after applying the “Offered Discount.”
  • Provide a button labelled “Proceed to Create Quote” on the screen.
  • On clicking the “Proceed to Create Quote” button, the following things are calculated:
    • A quote record is created, fetching the corresponding product and price list data.
    • Quote line items are created slab-wise.
    • Logic to calculate “Total Amount B2C “, “Total Amount B2B “, and “Total Amount Store Pick” is applied.
    • Logic to derive “effective price per B2C piece”, “effective price per B2B piece”, and “effective price per SFS piece” is applied.
    • A PDF is generated and attached to the quote record.

How much is the solution scalable?

The custom pricing engine built within the Salesforce platform offers scalability as the business grows. It is optimised for performance and can handle increasing volumes of data and pricing calculations as the company expands. 

The solution’s scalability can be further enhanced by adopting the best coding and data management practises, leveraging Salesforce’s scalability features, and optimising queries for efficient data retrieval and processing.

How did the solution benefit the client?

The custom dynamic pricing solution provided several benefits to the client

  • Increased Efficiency: Automating pricing adjustments reduced the time and effort required for manual price changes, allowing the team to focus on other strategic activities.
  • Improved Revenue Management: The dynamic pricing engine optimised pricing decisions based on real-time market data, competitor prices, and demand fluctuations. This resulted in better pricing strategies and increased profitability.
  • Enhanced Customer Experience: With dynamic pricing, the client’s sales team could offer personalised pricing to different customer segments, improving customer satisfaction and loyalty.
  • Better Decision-Making: The pricing engine provided accurate and timely pricing recommendations, enabling the team to make informed decisions based on data-driven insights.
  • Scalability and Adaptability: The custom solution built within the Salesforce platform allowed the team to scale their pricing capabilities as the business grew and adapted to changing market dynamics.

Conclusion 

The custom dynamic pricing solution empowered the client’s sales team to optimise pricing strategies, increase revenue, and deliver a superior customer experience. By leveraging the capabilities of the Salesforce platform, the solution provided scalability and adaptability, enabling the team to grow and thrive in a competitive market.