Use case: Displaying the ServiceNow CPQ native UI via direct URL
Summarize
Summary of Use case: Displaying the ServiceNow CPQ native UI via direct URL
This guide explains how ServiceNow CPQ customers can initialize and display the native Configuration UI using a direct URL instead of an external library like easyXDM. This method leverages a specific URL format to load a configurable product’s UI directly, either as a top-level window or embedded in an iframe.
Show less
Key Features
- Configuration URL Format:
https://{tenant}.cpq/ui/configure/{configurableProductId}where{tenant}is your ServiceNow CPQ tenant URL and{configurableProductId}is the product ID to configure. - Query Parameters: Additional settings can be passed using URL parameters such as version (
v), pricebook ID (pid), configuration ID (id), quote IDs, log settings, fields data, editability, layout, return URL, runtime token, API URL, and currency. These parameters enable dynamic control over the UI behavior and integration points. - Authentication: Using runtime tokens (
rt) and runtime API URLs (rta) is recommended for authenticated access, especially in headless or pre-authenticated environments. - Save and Cancel Behavior: When saving or canceling, the UI interacts with the ServiceNow CPQ backend and either redirects to a specified return URL or communicates with the parent window via postMessage, depending on implementation.
- Embedding Options: The configuration UI can be opened as a standalone window or embedded via iframe, with considerations for how save/cancel actions report results.
Key Outcomes
- Direct URL initialization simplifies embedding and accessing CPQ configuration interfaces without requiring external JavaScript libraries.
- Passing parameters via the URL allows flexible, context-aware configuration sessions that can load existing configurations, control editability, and specify UI layouts.
- Including a return URL enables seamless navigation post configuration, while omitting it triggers messaging to the parent window for custom handling.
- After saving or canceling a configuration, the session is cleared, preventing repeated submissions and ensuring data integrity.
- Saved configuration results can be retrieved through the Config API for integration with downstream systems, including sending data via webhooks.
Learn how to initialize a configuration UI using a URL instead of an external library.
This article provides an outline of how a ServiceNow CPQ Configuration UI can be initialized using a configuration URL rather than relying on an external library (such as easyXDM).
The base configuration URL is in the format https://{tenant}.cpq/ui/configure/{configurableProductId}, where:
- {tenant} is the ServiceNow CPQ tenant that you are using, which can be found in Salesforce or if using ServiceNow CPQ headless, the base URL of the Admin experience
- {configurableProductId} is the Product ID of the ServiceNow CPQ Configurable Product to use for the configuration
Example configuration URL: https://demo6.demo.logik.io/ui/configure/01t5f000006QKynAAG?v=1
Configuration URL query parameters
Additional settings and data can be passed via URL query parameters.
| Parameter | Description | Required | Values / Notes |
|---|---|---|---|
| v | Version | true | 1 |
| pid | Pricebook ID | Salesforce Pricebook ID | |
| id | Configuration ID | ServiceNow CPQ UUID of existing configuration to load | |
| lid | Quote Line ID | Salesforce Quote Line ID | |
| qid | Quote ID | Salesforce Quote ID | |
| log | Log Execution (Flightpath) | None | Available | Active This parameter is case sensitive. |
|
| cm | Committed Configuration ID | When a contracted order is amended, ServiceNow CPQ identifies the prior configuration ID. That ID then becomes the committed Configuration ID. | |
| fields | Fields |
Array of field objects. For example, In JavaScript, use encodeURI to ensure any special characters are escaped |
|
| ac | Action Context | null or "Amendment" | |
| e | Editability | One of:
|
|
| layout | Layout Variable Name | Name of the layout to load from the blueprint of the configurable product | |
| return | Return URL | URL to set window.location to on save or cancel. Needs to be encoded and URL-safe | |
| rt | Runtime Token | See note below | Runtime token from ServiceNow CPQ Admin Setup |
| rta | Runtime API URL |
Needs to be encoded and URL-safe. Highly recommended if using the runtime token parameter. Use encodeURI in Javascript to ensure that any special characters are escaped, especially when calling an API. |
|
| currency | Currency ISO Code |
If you are not accessing
the configuration URL where you have already authenticated (via Salesforce or directly), the runtime token will be required to authenticate. If you are accessing the configuration URL before authenticating through the associated
SFDC environment or accessing the configuration URL for a headless environment, the ServiceNow CPQ tenant URL needs to be listed as an origin for the leveraged runtime client. For example, https://<yourCPQUrl>.test.cpq.
If the version parameter is not included, the UI will not load, and you will receive the following error: "Error: A version must be specified."
If a return URL is not included, the UI will broadcast a postMessage up to the parent, with the UUID on save (such as {"uuid":
"8b88c843-d10b-468b-8c49-17f8c9698799"}) and an empty object on cancel ({}).
Using the configuration URL
The configuration URL can be used either as the top level window or in an iframe on a page.
Unlike when using the easyXDM example to initialize a configuration, configuration data will not be sent to the browser console in Javascript when using the configuration URL.
Considerations for using the configuration URL as the top level window URL:
- On the save or cancel actions, the ServiceNow CPQ UI will make the call to the ServiceNow CPQ backend to save or cancel the configuration. These calls can be viewed in the Network tab of the browser to see the data being sent and returned.
- If a return URL is included, the UI will attempt to set the window location to that URL on save ("Quote") or on cancel.
Considerations for using the configuration URL in an iframe:
- If a return URL is included, the UI will attempt to set the window location to that URL on save ("Quote") or on cancel. If a return URL is not included, the ServiceNow CPQ UI will broadcast a postMessage up to the parent, with the UUID on save (such as
{"uuid": "8b88c843-d10b-468b-8c49-17f8c9698799"}) and an empty object on cancel ({}). - For either implementation, after executing the save or cancel action, the configuration is removed. Subsequent save actions will result in a 404 error with an error message: "No Rules Engine found for Tenant with Config ID '<ServiceNow CPQ UUID>'. Subsequent cancel actions will also result in a 404 error.
Configuration result
The result of the saved Configuration can be accessed by using the GET API to retrieve the BOM data.
Postman Collection with Config API URL
The result can be sent to a downstream system via Webhook. See Webhooks.