---
sourceDocument: Brazil Sales Customer Relationship Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/order-management

 Release :

    - brazil

ft:locale :

    - en-US

ft:publication_title :

    - Brazil Sales Customer Relationship Management

ft:clusterId :

    - omgmt

bundleId :

    - omgmt

workflow :

    - Customer and Industry


---

# Using comments and the console to debug scripts

# Using comments and the console to debug scripts {#ariaid-title1}

Release version: Brazil  
Updated March 12, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) 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 comments and the console to debug scripts

ServiceNow CPQ allows administrators to use scripts in several areas such as advanced conditions for rules, advanced actions for rules, and enrichments to define behavior.
Debugging these scripts effectively is essential to ensure correct functionality before deployment.
This guide explains how to use comments and the console to facilitate script debugging within the ServiceNow CPQ environment.
Show full answer Show less  

## Key Features

* **Console.log for Debugging:** ServiceNow CPQ provides a debugger with a console output section where admins can run scripts and see real-time output. Using `console.log`, you can log text and variable values to the console to verify script behavior and data at different points in execution.
* **Comments for Clarity and Testing:** Comments are non-executed lines in the script used to explain code logic, temporarily disable code, or save snippets for future use. Single-line comments start with `//` and multiline comments are enclosed between `/` and `/`. Proper commenting improves maintainability and helps when revisiting or modifying complex rules.
* **Using Multiline Comments to Save Inputs:** For rules taking many inputs, you can paste the input JSON as a multiline comment in the debugger. This saves time by preserving input data for future debugging sessions without rewriting it.

## Practical Benefits for ServiceNow Customers

* Enables precise testing and validation of CPQ scripts, reducing errors before blueprint deployment.
* Helps maintain clear, understandable scripts through effective commenting, supporting future edits or troubleshooting.
* Facilitates efficient debugging by allowing admins to log key data and reuse input sets, saving time and effort.  
Learn how comments and the console can help you debug your scripts.

ServiceNow CPQ has several areas where the admin can use scripts to define behavior. These include advanced conditions for rules, advanced actions for rules, and enrichments.

## Advanced conditions for rules {#rules-enrichments-comments-and-console_log__section_z4k_cjf_dhc}

## Advanced actions for rules {#rules-enrichments-comments-and-console_log__section_cjj_cjf_dhc}

## Enrichments {#rules-enrichments-comments-and-console_log__section_xgg_cjf_dhc}

This article highlights a few key features to help you test and prepare your code before you deploy it in a blueprint.  
Note:  
The scripting language in ServiceNow CPQ is JavaScript-like, meaning it follows JavaScript-style syntax but lacks the full capabilities of JavaScript.

## Console.log {#rules-enrichments-comments-and-console_log__console.log}

When the admin starts to write a script, the ServiceNow CPQ Admin looks like this:


Clicking Run Debugger in the lower panel raises the debugger and the Debugger Output section. This section is also called the console.

This box shows the output of the script based on the script and the inputs added to the debugger (if applicable). For example, the BOM enrichment script shows the updated BOM based on the enrichment and inputs put in the
debugger.

Lines of code can be logged to the console. So, you can send text to the console, as in the following:


You can also log variables, which is helpful to make sure your script is working correctly. You can add text to the log to help the lines of code stand out:


## Comments {#rules-enrichments-comments-and-console_log__comments}

Comments are lines of code that the script ignores. Comments have a few uses. First, it is very helpful to future coders (and to you, when you revisit the code much later) if you have commented on how and why you coded lines of the
script as you did. Commenting can also be used to save code to use again. And if you do not use a block of code but may want to use it later, you can comment it so it does not affect your current work.

You can write comments on a single line or across multiple lines.

To add single-line comments, use two slashes. Anything written after the slashes on the same line is ignored by the script.

`// This comment is ignored by the script`

However, any code before the slashes is still executed. For example, in the image below, the variable `be4comment` remains 12345, as the script ignores the comment "67890" following the slashes.


To create a multiline comment, add a slash and an asterisk before the comment. Add an asterisk and a slash after the comment.

    /*
    Your comment goes here.
    It can span multiple lines.
    */

When you add a multiline comment, be careful not to comment out important elements such as closing brackets, parentheses, or return statements.

When you frequently revisit or modify a rule that takes inputs from many other fields, it can be helpful to paste the input into the debugger section as a multiline comment. This way, when you return to work on the rule later, you
won't need to rewrite the inputs.

    /* inputs
    {"Field1": "testValue1",
        "Field2Quantity": 2,
          "Field3": "testValue3"
        },
    */


