Spread the love

For the #MadeInItaly series where I want to showcase amazing artisanal Italian products from our incredible Italian Ohana, today’s guest post is delivered by Raffaele Preziosi, a certified Salesforce Developer and Application Architect who was born in Naples (Italy). He is passionate about the Salesforce platform, JavaScript, and DevOps. Currently, he works as a consultant at Accenture Nordics in Copenhagen, where he continues to innovate and develop solutions for clients in the Salesforce ecosystem.


The Javascript Quote Calculator Plugin (QCP) of SteelBrick CPQ is a tool that allows users to enhance the functionality of the quote line editor within Salesforce.

By utilizing JavaScript, users can implement custom logic to manipulate quotes and quote lines both before and after pricing rules are calculated.

This customization extends to managing the visibility and editability of the fields displayed in the quote process.

The Challenge: Managing QCP Code within Salesforce

Unfortunately, the javascript QCP code must be stored as data within Salesforce (in the field SBQQ__Code__c of the object SBQQ__CustomScript__c) making it difficult to manage and track changes effectively.
As developer you would like to manage that code in your IDE alongside other metadata within your version control system.

The move-qcp sf CLI plugin can address this issue. This tool allows you to efficiently organize the QCP code, and automate the its deployment.

The  move-qcp plugin changes the way you develop and deploy QCP by allowing you to:

  • Versioning QCP Code: Your code is securely stored, easily accessible, and conveniently managed alongside your other version-controlled assets. This ensures that you have complete control over your qcp code and can effectively track and review changes.
  • Automated Deployment: The plugin automatically deploys the QCP to the target org, avoiding the need to manually copy and paste the code into Salesforce.
  • Modularization: Take advantage of modularization by utilizing modules to split the QCP code into multiple files. By splitting your QCP code into multiple files using modules, you can enhance readability, maintainability, and collaboration among your development team.
  • Code Minification: The plugin automatically minifies the code before deploying it to the target org. This optimization step helps avoid reaching the maximum character limit of the textarea field.

How to Get Started

  1. Open your terminal and run the command (Salesforce CLI is necessary):
    sf plugins install move-qcp
  2. Within your repository, create a dedicated folder for your QCP using the create command. This is where you’ll organize your QCP-related files. Replace “MyQCP” with your desired custom script name, which will also be the folder name.
    sf cpq qcp create -n MyQCP

    The command will create separate files for each method of the quote calculator plugin.
    The main.js file will import modules from other files, enhancing code organization.
    The config.json file can include additional fields for your quote calculator plugin.
    Main.js and config.json are the only required files, the other ones can be deleted/replaced.

3. When your changes are ready run the following command to insert/update your QCP in the Org. Replace “orgAlias” with the authenticated org alias/username and ./QCP with the directory of your QCP
sf cpq qcp deploy -u orgAlias -d ./MyQCP

If the command succeeds, it will print the Id of the custom script:

While you can add multiple custom scripts to your repository, it’s important to note that Salesforce CPQ currently allows only one active script at a time.

You can streamline your deployment process, integrating the command into your CI/CD pipeline!