Use case: Using the Salesforce Quote Calculator plugin to integrate data from ServiceNow CPQ to Salesforce quotes and quote lines

  • Release version: Zurich
  • Updated October 8, 2025
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Using the Salesforce Quote Calculator plugin to integrate data from ServiceNow CPQ to Salesforce quotes and quote lines

    This use case explains how ServiceNow CPQ data can be integrated into Salesforce CPQ quotes and quote lines by using the Salesforce Quote Calculator Plugin (QCP). It specifically applies to the ServiceNow CPQ Extension for Salesforce CPQ package version 1.7 or earlier. The integration leverages extended configuration data stored in theProductList.extendedJSON object in ServiceNow and passes it into Salesforce to manipulate quote line fields dynamically during quote calculation.

    Show full answer Show less

    Key Features

    • Extended Information Transfer: The ProductList.extended object in ServiceNow CPQ holds JSON key:value pairs that include custom field data and arrays, which can be passed through advanced product actions.
    • Custom BOM Data Handling: When a configurable product is added to the Bill of Materials (BOM), its extended data appears in a custom Salesforce quote line object named “BOM Data” (LGKBomDatac).
    • Quote Calculator Plugin Custom Script: A JavaScript script running in Salesforce CPQ’s Quote Calculator Plugin parses the BOM Data JSON, extracts specific values (e.g., “newValue”), and updates Salesforce quote line custom fields accordingly.
    • Script Configuration: All quote and quote line fields referenced by the script (such as LGKBomDatac, SBQQProductCodec, and TestTextc) must be explicitly defined as inputs in the custom script record.
    • Enabling the Plugin: The script must be registered under Salesforce CPQ’s Installed Packages settings in the Quote Calculator Plugin tab, with legacy calculator disabled if necessary.

    Practical Application

    Once configured, whenever a quote calculation is triggered in Salesforce CPQ (for example, by clicking “Calculate”), the Quote Calculator Plugin executes the custom script. This process dynamically updates quote line fields based on the extended configuration data from ServiceNow, enabling customers to synchronize complex product configuration details between ServiceNow CPQ and Salesforce CPQ seamlessly.

    This integration helps ensure that Salesforce quote lines reflect detailed configuration information managed in ServiceNow CPQ, improving accuracy and automation in pricing and quoting workflows.

    In the ServiceNow CPQ Extension for Salesforce CPQ package version 1.7 or earlier, use the Salesforce Quote Calculator Plugin to parse extended information from a configuration and map it to custom fields.

    Note:
    This article applies to the ServiceNow CPQ Extension for Salesforce CPQ package version 1.7 or earlier. If your version is 1.8 or later, see Use case: Configuration line item to quote line flow.

    Using the extended information of the ServiceNow CPQ ProductList object with the Salesforce Quote Calculator plugin (QCP), data may be passed from ServiceNow CPQ into Salesforce and used to manipulate both quote and quote line information.

    ProductList.extended may only be populated with an advanced product action, as shown here.

    Advance function Code

    The ProductList.extended object takes the form of a JSON object and accepts key:value pairs. In the example above, we pass through a dummy text string, “QCP Test Value”, with the newValue key. ProductList.extended can hold field values, as well as an array of JSON objects.

    When this product is added to the bill of materials (BOM), we can view its associated info in the custom object “BOM Data”, which is held at the quote line of the configurable product.

    Code

    To leverage this extended information, we will need to use the Quote Calculator Plugin. To start, navigate to the Custom Scripts item in Salesforce.

    Performance

    Here, you can write a script to leverage the extended information from ServiceNow CPQ and use it to manipulate fields in SFDC. The following script is the sample script used in this instance.

    export function onBeforeCalculate(quote, lines) {
    	var result;
    	var resultValue;
    	var product_code = "headlessItem3";
    	if (lines != null) {
    		lines.forEach(function (line) { //Parsing all quote lines to find BOM Data object
    			if(line.record["LGK__BomData__c"] != null){                        
    				var configJson = JSON.parse(line.record["LGK__BomData__c"]);
    				var itemsJson = configJson["items"]; //Create JSON object containing all items in BOM data
    				itemsJson.forEach(function(itemsLine){ //For each item in the BOM Data
    					if(itemsLine["productCode"] == product_code){ //Checking for item "headlessItem3"
    						result = itemsLine["extended"]; //Parses extended information to find "newValue"
    						resultValue = result["newValue"]; //Assigning keyed value of "newValue"
    					}
    				});
    			}
    		});
    		lines.forEach(function (line) { //For each line in the quote
    			if (line.record["SBQQ__ProductCode__c"] == product_code){ //Checking for the line item "headlessItem3"
    				line.record["Test_Text__c"] = resultValue; //Setting the quote line field "Test Text" with the value of resultValue
    			}
    		});
        }
        return Promise.resolve();
    }; 

    Any quote fields or quote line fields referenced by the custom script must be explicitly defined in the appropriate inputs on the custom script record. Our sample script references three quote line fields: LGK_BomData c, SBQQ_ProductCode c, and Test_Text c.

    Once your script has been written, define it in the Salesforce CPQ settings. Follow these steps:

    1. In Setup, search for “Installed Packages” using Quick FInd.
    2. Next to “Salesforce CPQ”, click Configure.
    3. Select the Pricing and Calculation tab.
    4. If necessary, deselect Use Legacy Calculator.
    5. Select the Plugins tab.
    6. Define your custom script in the Quote Calculator plugin, and then click Save.

    Performance graph

    When you navigate to your quote and trigger any action that performs a calculation in SFDC (such as clicking “Calculate”), the Quote Calculator Plugin runs and modifies fields as designated.