CPQ: Enhance your Quote Line Editor with Custom Scripts

The CPQ Salesforce Revenue Cloud Quote Line Editor is a great tool. In comparison with the standard opportunity line editor, its user interface and the different features that can interact with it can be a game-changer for a sales rep.

But, like every single APP, the Salesforce Revenue Cloud Quote Line Editor has its own limitations. And one of those limitations is the data source.

The Quote Line Editor can read information from two sources. The Quote and the Quote Line.

  • The Quote Source
    Information from this source can be any field in your Quote record. But also, any field from the Quote’s Opportunity, or from the Opportunity’s Account can be captured in the Quote, and be ready for the Quote Line editor.
  • The Quote Line Source
    Information from this source can be any field in your Quote Line record. But also, any field from the product added to that Quote Line.

As you can observe, both paths have similar behaviour, but each one starts from a different object. The reason why we can use information stored in the Account, the Opportunity, or the Product is the relationship between these objects. One Quote can have only one opportunity, and one opportunity can have only one account. This one-to-one (1:1) relationship from the Quote point of view. This relationship allows us to retrieve information from the “parent” record into our quote line editor. We do not need SOQLs to know the account type of our Quote’s Account, we can have a formula field in the quote to retrieve this value for example.
And the same happens in the Quote Line. One quote line can have only one product. Again a 1:1 relationship from the Quote Line point of view.

But you can face situations where the information you need to reach is in an object related to your quote by a junction object. In other words, you are facing a 1:N relationship from the quote view. And this situation could be a blocker in case you can not modify the data model in your org.

The Quote Calculator/Editor can not access the data stored in the objects in the red area because of the nature of the relationship between the junction object and account

Fortunately, one of the many features in Salesforce Revenue Cloud is the Javascript Quote Calculator Plugin. Yes Javascript, If you thought Salesforce Revenue Cloud was no place for a developer, you were wrong. I mean, you might not need this feature, the number of features within this product is so large, that most of the situations can be covered without a single line of code. But, this is a good example of why you need developers with knowledge of how CPQ or Salesforce Revenue Cloud works.

Among other benefits, that I recommend you to explore, the Javascript Quote Calculator Plugin gives you the chance of running code before the quote calculation or before your price rules run. That is why it is perfect for our example. Remember, we can not access the info stored in our custom Object de to the nature of the relationship with the Object account. So we need to add some logic to calculate the right record we need for our quote. To solve this case all the customisation we need will be:

  • Go to Custom Script Object and create a new record.
  • Go to Installed Pakages > Salesforce CPQ > Configure
  • In the Plugins tab, add your Custom Script record name to Quote Calculator Plugin and Save

And with this little config, you just specified to the Quote Line Editor that some Javascript code needs to run at any point of the calculation. The when will depend on the methods you specify in the Javascript. Now will be time to use your bests JS skills or call a developer for creating a code to be added to the Code field in the custom script object.

And just a bit of final advice, try to keep your custom script as simpler as possible. If you start adding more and more logic to that script, it will become a monster potentially harder to maintain. Remember the C in CPQ stands for Configuration, so try to do as much as you can with point and click 😉

 

Photo by Amol Tyagi on Unsplash

amol-tyagi-UZFCQPNc4bs-unsplash (1)
By Pedro Molina
12 May 2021
CPQThe Dev ZoneThe Good Systems Blog

Share this post

Catt to action

Amet aliquam id diam maecenas ultricies mi eget mauris

Lorem ipsum dolor sit amet, consectetur elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.