Skip to main content
All CollectionsCPQ, Vlocity, Sandbox SeedingGearset for CPQCompare and deploy CPQ configuration
Using SOQL queries to retrieve specific CPQ records for comparison
Using SOQL queries to retrieve specific CPQ records for comparison

Write your own SOQL queries to filter and retrieve specific subsets of CPQ records to be included for comparison and deployment

Stephen Chambers avatar
Written by Stephen Chambers
Updated over 2 months ago

The comparison filter dialog in Gearset has traditionally been used to filter the metadata types and items to be compared in order to reduce the number of results and reduce comparison times. This can be accomplished simply by checking or unchecking the items you wish to include or exclude.

Filtering to the subset of CPQ configuration you wish to compare requires a slightly different mechanism and involves the use of SOQL queries to specify which records should be retrieved for comparison.

SOQL queries and filtering related items behavior

  • SOQL queries are applied on a per-object basis

  • If only the parent object has a SOQL query applied, then any related items will be automatically filtered out from the comparison. For example, filtering out Product2 configuration via a SOQL query will also filter out related items such as product options and features from the comparison results.

  • However, related items will not be filtered out if a SOQL query has been specified for a related object(s). For example, having a SOQL query on Product2 and on ProductOption will display the results for both in the comparison results.

  • SOQL queries on Lookup Objects are also supported.

Using SOQL queries to pre-filter CPQ records for comparison

  1. Choose your CPQ enabled orgs as the source and target of your comparison

  2. Open the Manage custom filters dialog

  3. Go to the CPQ item tab (Advanced Approvals and Billing are also supported)

  4. Enter your SOQL query into the input field provided and click Test SOQL query

  5. The number of records matching your query will be displayed for your source and target. Any syntax errors with your query or problems retrieving the results will also be displayed.

  6. When you've finished configuring the metadata and CPQ records to include in your comparison, click OK and start your comparison

Note: You can save SOQL queries as part of your metadata custom comparison filters to help create templates for reuse in future comparisons.

Example query format

Only the WHERE clause conditions are needed when using a SOQL query to filter records. For example, the query format that you'd use in Gearset would therefore take the following format:

  • CreatedDate > 2022-07-01T00:00:00Z AND CreatedDate < 2023-01-01T00:00:00Z

  • Family = 'Hardware' OR Family = 'Miscellaneous'

  • ProductCode LIKE 'USB%'

  • Description != null

  • IsActive = True

Did this answer your question?