The CPQ Reconfigure API
Summarize
Summary of The CPQ Reconfigure API
The CPQ Reconfigure API is a custom Salesforce API designed to headlessly invoke CPQ services for reconfiguring existing quote bundles. Unlike RFQ APIs, it specifically updates quote bundles by modifying configuration details without user interface interaction, enabling automated and efficient quote adjustments.
Show less
Prerequisites
- The Runtime Client Token must be configured in Salesforce Admin Custom Settings with an origin matching the CPQ URL (without a trailing slash).
- The Runtime Configuration URL should also be set, typically matching the administration URL.
- Remote Site Settings in Salesforce Setup must include the CPQ domain as a remote site URL to allow API calls.
- Unique uniqueIdentifier values are required for products to ensure correct matching of child lines during reconfiguration, preventing incorrect updates.
API Details and Usage
- Endpoint: /services/apexrest/LGK/cpq-quote-lines/reconfigure
- Method: PATCH with JSON requests and responses
- Supports only two fields in the request body: configurationId and configurableQuoteLineId
- Responds with a complete quote record including all quote lines, not just the updated ones, facilitating comprehensive quote state awareness
- Requests can be made via REST or directly through Apex using a Map with the same parameters, returning the quote as a JSON string
Practical Application for ServiceNow Customers
ServiceNow customers integrating with Salesforce CPQ can leverage this API to programmatically update quote bundles during sales processes. This enables automation of quote adjustments without manual intervention, improving accuracy and efficiency in sales quoting workflows. Ensuring unique product identifiers and correct remote site configuration is critical for reliable operation.
Custom Field Mapping
Fields on the Salesforce Quote Line object that match names in CPQ's extended or pricing information can be automatically populated, allowing for seamless synchronization of custom data during reconfiguration.
The CPQ Reconfigure API headlessly invokes CPQ services to reconfigure a quote bundle.
The CPQ Reconfigure API is a custom Salesforce API that invokes CPQ services headlessly. Unlike RFQ, this API is used to reconfigure an existing quote bundle.
Prerequisites
The Runtime Client Token must be set in the Admin Custom Settings page in Salesforce. The token must include an origin that matches the CPQ URL, which cannot include a trailing slash (/) character.
The Runtime Configuration URL must also be set in the Admin Custom Settings page. In most cases, this should match the administration URL on the same page.
In Salesforce Setup, go to Security, and then to Remote Site Settings. Add a new remote site with your CPQ domain as the URL.
API details
Endpoint: /services/apexrest/LGK/cpq-quote-lines/reconfigure
Methods: Receives and returns application/json.
PATCH: The method currently only supports two fields, configurationId and configurableQuoteLineId.
Response: A quote (SBQQ__Q__c) record.
Request example:
{
"configurationId":"86ec190e-cba8-4b1d-a2dc-ba47714a22b5",
"configurableQuoteLineId":"a137d00000977oWAAQ"
}
Response example:
{
"attributes": {
"type": "SBQQ__Quote__c",
"url": "/services/data/v56.0/sobjects/SBQQ__Quote__c/a0zR0000003f3GLIAY"
},
"Name": "Q-00090",
"Id": "a0zR0000003f3GLIAY",
"SBQQ__LineItemCount__c": 4,
"SBQQ__LineItems__r": {
"totalSize": 4,
"done": true,
"records": [
{
"attributes": {
"type": "SBQQ__QuoteLine__c",
"url": "/services/data/v56.0/sobjects/SBQQ__QuoteLine__c/a0vR0000005LPRxIAO"
},
"SBQQ__Quote__c": "a0zR0000003f3GLIAY",
"Id": "a0vR0000005LPRxIAO",
"Name": "QL-0000122",
"SBQQ__ProductName__c": "LGK Machine"
},
{
"attributes": {
"type": "SBQQ__QuoteLine__c",
"url": "/services/data/v56.0/sobjects/SBQQ__QuoteLine__c/a0vR0000005LPRyIAO"
},
"SBQQ__Quote__c": "a0zR0000003f3GLIAY",
"Id": "a0vR0000005LPRyIAO",
"Name": "QL-0000123",
"SBQQ__ProductName__c": "Analytics Software"
},
{
"attributes": {
"type": "SBQQ__QuoteLine__c",
"url": "/services/data/v56.0/sobjects/SBQQ__QuoteLine__c/a0vR0000005LPS2IAO"
},
"SBQQ__Quote__c": "a0zR0000003f3GLIAY",
"Id": "a0vR0000005LPS2IAO",
"Name": "QL-0000124",
"SBQQ__ProductName__c": "Extended Warranty"
},
{
"attributes": {
"type": "SBQQ__QuoteLine__c",
"url": "/services/data/v56.0/sobjects/SBQQ__QuoteLine__c/a0vR0000005LPS3IAO"
},
"SBQQ__Quote__c": "a0zR0000003f3GLIAY",
"Id": "a0vR0000005LPS3IAO",
"Name": "QL-0000125",
"SBQQ__ProductName__c": "Scanner"
}
]
},
"SBQQ__Type__c": "Quote"
}
Requests can be made directly through Apex. The argument is a Map<String,Object> with the same fields used in the REST API. For example:
Map<String, Object> requestBody = new Map<String, Object>{
'configurableQuoteLineId' => '01t8a000005hldvAAA',
'configurationId' => '79a3ffdd-7dd0-41f6-8700-4bd7506407c7'
};
String result = LGK.CpqReconfigureApiController.reconfigure(requestBody);
The response is a JSON formatted string representing the quote object, similar to the response in the REST APIs.
Custom field mapping
If a field on the Quote Line object in Salesforce has a name that matches, custom values can be written from the extended or pricing information in a CPQ product.