Subscribe to Updates

    Get the latest business apps & software news from FMT.

    What's Hot

    FileMaker ReadQRCode & GetLiveText functions

    June 15, 2022

    Parallel Backups on FileMaker Server

    June 15, 2022

    Claris FileMaker Server 19.5 Overview

    June 15, 2022
    Facebook Twitter Instagram
    Trending
    • FileMaker ReadQRCode & GetLiveText functions
    • Parallel Backups on FileMaker Server
    • Claris FileMaker Server 19.5 Overview
    • Claris FileMaker 19.5 Overview | DB Services
    • NoSQL vs. Relational Databases | DB Services
    • Claris Problem Solvers Circle | DB Services
    • Business Days in Salesforce CRM Analytics (Tableau CRM)
    • FileMaker UPS Integration | DB Services
    Facebook Twitter Instagram YouTube
    SalesForce – FileMaker Business Software & Hosting SalesForce – FileMaker Business Software & Hosting
    Demo
    • Home
    • Features
      • Example Post
      • Typography
      • Contact
      • View All On Demos
    • Lifestyle

      Sci-fi Television Star Summer Glau Added to Next Play Launch

      March 15, 2021

      Season-less Fashion Trends are Now Reflecting Our Lifestyles

      January 19, 2021

      Windows 10 To Be Retired in 2025, As New OS Unveils

      January 18, 2021

      Average Mobile Data Usage Now Exceeds 10GB Per Month

      January 17, 2021

      Tom H is Ready To Take a Break After Spider-Man 3

      January 16, 2021
    • Typography
    • Travel
      1. Lifestyle
      2. Arts & Culture
      3. Food
      4. View All

      Sci-fi Television Star Summer Glau Added to Next Play Launch

      March 15, 2021

      Season-less Fashion Trends are Now Reflecting Our Lifestyles

      January 19, 2021

      Windows 10 To Be Retired in 2025, As New OS Unveils

      January 18, 2021

      Average Mobile Data Usage Now Exceeds 10GB Per Month

      January 17, 2021

      Guitarist John 5 Shreds at Sherman Theater in Stroudsburg

      March 13, 2021

      The New Home Decor Items and Collections We’re Excited About Now

      March 12, 2021

      Top 4 Composition Tips for Better Fashion Photography

      January 22, 2021

      10 New Designs, Design Firms Team Up to Launch This May

      January 22, 2021

      Austrians Dine Out Again After Virus Lockdown

      January 15, 2021

      The Best Places to Dine Out in Dingle This Summer

      January 15, 2021

      Is the Best New Fast-Food Chicken Sandwich By a Long Shot

      January 15, 2021

      Slim Chickens Bringing Fast-Food Restaurants to 9 Alabama Locations

      January 15, 2021

      Coronavirus: Greece is Officially Open — But Will the Tourists Come?

      March 14, 2021

      2m People Go Through US Airports, Travel Rebounds With Vaccination

      March 11, 2021

      Father’s Day Walks, Water Sports, & Meals in Plymouth

      January 15, 2021

      Review: Bucket List Destinations 2021 Across the Globe

      8.9 January 15, 2021
    SalesForce – FileMaker Business Software & Hosting SalesForce – FileMaker Business Software & Hosting
    Home » Salesforce CPQ: Percent of Total for Amended Quotes
    Uncategorized

    Salesforce CPQ: Percent of Total for Amended Quotes

    DBServicesBy DBServicesMarch 31, 2022No Comments7 Mins Read
    Share
    Facebook Twitter LinkedIn Pinterest Email


    By
    Matt Clark 

    Posted on 
    March 31st, 2022 

    in 
    Salesforce,

    Free Downloads

    Salesforce users looking to enhance their product-quoting processes can take advantage of Salesforce Configure, Price, Quote Software, or CPQ. Salesforce CPQ allows users to create complex pricing structures through a range of new functionality, including the ability to dynamically price an item based on a percentage of the total quote amount. This Percent of Total pricing, or POT, works well when creating a new quote, but users may be disappointed to find that it breaks down when they attempt to amend an existing quote. However, with some JavaScript and a little TLC we can bridge this gap in functionality, allowing you to amend quotes to your heart’s content. Let’s take a closer look.

    The Problem

    Let’s suppose your company sells electronics, and you want to provide an optional support package for your customers. Because the amount of work involved varies based on the amount of hardware they purchase, you decide to price the support package as a percentage of the total cost of the purchased hardware. This works well for larger accounts, but you decide it’s not worthwhile to maintain smaller accounts that might only pay, say, $50 a month. To avoid this, you add a minimum amount of $200 to the support price calculation, and your shiny new “Hardware Support Package” is configured something like this:

    salesforce cpq example pricing package

    So far, so good! You whip up a couple of quotes to make sure the Percent of Total price calculation still works correctly with your minimum price constraint. Here is an example of a quote where the support price is 25% of the software total, since this amount is greater than the $200 minimum:

    salesforce cpq edit quote example

    And an example of a quote where the support price defaults to the $200 minimum:

    salesforce cpq edit quote example 2

    It works exactly as expected, and your confidence quickly grows. You officially implement this pricing structure, and you begin sending quotes like those above to your customers. You receive good feedback from your sales reps, until one of them tries to amend one of these quotes in a previously accepted contract. Let’s use the smaller quote from above, and assume the customer now needs a total of three charge controllers. The additional cost should push the new Percent of Total calculation above the $200 minimum, and the amendment quote should reflect the additional cost of the support package. However, our new quote seems to have missed this memo:

    salesforce cpq amended quote incorrect example

    Needless to say, this
    behavior can lead to lost profits on amended contracts. We have a problem.

    The Solution

    According to the official documentation, “Salesforce CPQ
    doesn’t support the Percent of Total Constraint field on amendment
    quotes.” Rather than letting unaware users face bizarre or inconsistent
    results when attempting to amend a quote, CPQ simply ignores any such POT
    fields. Thus, to get the calculation to function properly, we first have to
    override this default behavior; then, we can implement our own solution.

    CPQ’s default behavior works roughly as follows: if a quote item
    on an amended quote uses Percent of Total pricing and that item has either a minimum or maximum
    price constraint, then CPQ automatically sets the unit price of that item to
    zero. Thus, one way to circumvent this behavior is to get rid of the price
    constraint of a POT item whenever it appears on an amended quote. (Astute
    readers may note that this sounds like a bad idea, given that our whole goal is
    to preserve the price constraint; this will be accounted for in our next step.)

    Step 1: The Price Rule

    One of the easiest ways to
    automatically adjust price calculations is to create a price rule, so let’s try
    that. The entry
    conditions
     for our new
    rule should essentially mimic CPQ’s default behavior outlined above; we want
    our conditions to apply only to quote lines on an amended quote which have
    constrained POT pricing.  Setting the calculator evaluation event to
    “On Initialization;Before Calculate” allows our rule to run before
    this particular bit of CPQ default behavior, and adding two new Price Actions
    to the rule allows us to zero out the pricing constraints:    

    salesforce cpq price action rule
    salesforce cpq price conditions
    salesforce cpq price action

    Step 2: The Plugin

    Now that we have circumvented CPQ’s default behavior, we are free to create our own solution. Salesforce CPQ allows users to extend its functionality through custom scripts, and for our situation, we want to create a Quote Calculator Plugin.  As the name suggests, this plugin will run every time a quote is (re)calculated, which allows us to define the logic for calculating our amended POT price. 

    In order for our plugin to calculate the price correctly, it needs data from three different types of records: Quote, Quote Line, and Subscription. These objects all have fields that reference the “original quote,” which allow us to directly compare the new quote data against the data from the quote being amended.

    With this information in hand, we can calculate the desired price for our item and set the list price accordingly. The code snippet included below is excerpted from our Quote Calculator Plugin:

    quoteLineModels.forEach(function (line) {
          if (line.record["SBQQ__SubscriptionPricing__c"] === "Percent Of Total") {
            line.record["_SBQQ__ListPrice__c"] = line.record["SBQQ__ListPrice__c"];
            Object.defineProperty(line.record, "SBQQ__ListPrice__c", {
              get: function () {
                return this["_SBQQ__ListPrice__c"];
              },
              set : function (newValue) {
                if (!this["potCalculatedPriceHasBeenSet"]) {
                  this["PoT_Calculated_List_Unit_Price__c"] = newValue;
                  this["potCalculatedPriceHasBeenSet"] = true;
                }
                this["_SBQQ__ListPrice__c"] = newValue;
      
                let aggregatedSubData = quoteModel.record.attributes["aggregatedSubData"];
                let originalQuoteLinePoTSettings =
                  aggregatedSubData && quoteModel.record.attributes["aggregatedSubData"][line.record["Id"]]
                    ? quoteModel.record.attributes["aggregatedSubData"][line.record["Id"]].originalQuoteLinePoTSettings
                    : "";
                let potSubscriptionsCalculatedListUnitPrice =
                  aggregatedSubData && quoteModel.record.attributes["aggregatedSubData"][line.record["Id"]]
                    ? quoteModel.record.attributes["aggregatedSubData"][line.record["Id"]]
                        .potSubscriptionsCalculatedListUnitPrice
                    : "";
                if (
                  quoteModel.record["SBQQ__Type__c"] === "Amendment" &&
                  this["SBQQ__PriorQuantity__c"] &&
                  originalQuoteLinePoTSettings
                ) {
                  let { minimumUnitPrice, maximumUnitPrice } = originalQuoteLinePoTSettings;
                  let totalListUnit = potSubscriptionsCalculatedListUnitPrice;
                  if (minimumUnitPrice) {
                    let totalAboveConstraint = (minimumUnitPrice - (totalListUnit + newValue)) * -1;
                    let constraintWasExceededPriorToQuote = minimumUnitPrice - totalListUnit <= 0;
                    if (totalAboveConstraint > 0 && !constraintWasExceededPriorToQuote) {
                      this["_SBQQ__ListPrice__c"] = totalAboveConstraint;
                    } else if (totalAboveConstraint <= 0) {
                      this["_SBQQ__ListPrice__c"] = 0;
                    }
                  } else if (maximumUnitPrice) {
                    let totalAboveConstraint = (maximumUnitPrice - (totalListUnit + newValue)) * -1;
                    if (totalAboveConstraint >= 0) {
                      this["_SBQQ__ListPrice__c"] = 0;
                    }
                  }
                }
              }
            });
          }
        });
    

    This code is part of our onAfterPriceRules() method, which is executed during the second round of calculations. The most important part to note is that we are updating the setter for each quote line item’s list price attribute to use our custom logic. Also, it may be helpful to note that the above attribute “aggregatedSubData” is used to store the “original quote” info returned by a SOQL query earlier in the script. The exact details of your implementation will depend on how your org is configured, and more details and examples can be found in the CPQ Documentation.  

    The Conclusion

    Salesforce CPQ provides great tools for businesses to tailor their pricing practices to best suit their own needs. If you need to further customize your process to add Percent of Total Calculations on Amended Quotes reach out to us at DB Services and we’d be happy to help!

    Need help with your Salesforce digital transformation? Contact us to discuss Salesforce consulting, implementation, development, and support!

    Download

    Download the Salesforce CPQ Quote Calculator Plugin

    Please complete the form below to download your FREE Salesforce file.

    Matt Clark thumbnail
    Matt Clark

    Matt is a reliable and precise Salesforce
    developer who is motivated by providing the highest-quality results to clients.
    His commitment to quality, consistency, and organization mean he is skilled at problem-solving
    and catching errors or flaws in design.  

    Amended CPQ Percent Quotes Salesforce Total
    Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Tumblr Email
    DBServices
    • Website

    Related Posts

    FileMaker ReadQRCode & GetLiveText functions

    June 15, 2022

    Parallel Backups on FileMaker Server

    June 15, 2022

    Claris FileMaker Server 19.5 Overview

    June 15, 2022

    Comments are closed.

    Demo
    Our Picks

    Noise-Cancelling Headphones For a Superb Music Experience

    January 15, 2020

    Harry Potter: 10 Things Dursleys That Make No Sense

    January 15, 2020

    Dubai-Based Yacht Company is Offering Socially-Distanced Luxury

    January 15, 2020

    The Courier – a New Song with Benedict Cumberbatch

    January 14, 2020
    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • YouTube
    • Vimeo
    Don't Miss
    Uncategorized

    FileMaker ReadQRCode & GetLiveText functions

    By DBServicesJune 15, 20220

    By Hayden Hobbs  Posted on  June 15th, 2022  in  FileMaker, Free Downloads, Mobile With the…

    Parallel Backups on FileMaker Server

    June 15, 2022

    Claris FileMaker Server 19.5 Overview

    June 15, 2022

    Claris FileMaker 19.5 Overview | DB Services

    June 15, 2022

    Subscribe to Updates

    Get the latest creative news from SmartMag about art & design.

    About Us
    About Us

    Your source for the lifestyle news. This demo is crafted specifically to exhibit the use of the theme as a lifestyle site. Visit our main page for more demos.

    We're accepting new partnerships right now.

    Email Us: info@example.com
    Contact: +1-320-0123-451

    Our Picks

    Noise-Cancelling Headphones For a Superb Music Experience

    January 15, 2020

    Harry Potter: 10 Things Dursleys That Make No Sense

    January 15, 2020

    Dubai-Based Yacht Company is Offering Socially-Distanced Luxury

    January 15, 2020
    New Comments
    • Twicsy on Coronavirus: Greece is Officially Open — But Will the Tourists Come?
    • https://62b2ffff12831.site123.me/blog/canadian-pharmaceuticals-for-usa-sales on Guitarist John 5 Shreds at Sherman Theater in Stroudsburg
    • https://62b2f636ecec4.site123.me/blog/canadian-pharmaceuticals-online on Guitarist John 5 Shreds at Sherman Theater in Stroudsburg
    • canadian discount pharmacies on Guitarist John 5 Shreds at Sherman Theater in Stroudsburg
    SalesForce – FileMaker Business Software & Hosting
    Facebook Twitter Instagram YouTube
    • Home
    • Lifestyle
    • Arts & Culture
    • Travel
    © 2022 FMT - MacLane Nova Digital Media - USA - Canada - Mexico - Sable Island - Bermuda - Isle of Man - Scotland - UK - France - Spain - Italy - Sweden - Australia - New Zealand -

    Type above and press Enter to search. Press Esc to cancel.