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

Work with Desynit

Looking for exceptional, professional Salesforce support?

Our independent tech team has been servicing enterprise clients for over 15 years from our HQ in Bristol, UK. Let’s see how we can work together and get the most out of your Salesforce implementation.