CPQ Product Search Plugin

Use the Product Search plugin to modify or add specificity to product filter searches and guided selling searches.
Available in: All Salesforce CPQ Editions

You can choose from two modes that control how the plugin modifies base Salesforce CPQ product searches.
  • Enhanced: Add more parameters to the WHERE clause of the product search's existing SOQL query.
  • Custom: Completely replace the product search's query logic with your own.

Salesforce CPQ applies the modified search immediately upon entering the product search screen, so the initial group of searchable products is already filtered.

You can configure the Product Search plugin to filter a product search based on certain parameters when users enter their own search queries. For example, in Product Search, you could configure the plugin to return all search results in descending order from the most recent Last Ordered Date. When the user enters the Product Search, the products returned in the search results are shown from the most recent Last Ordered Date. Users can further filter through the Product Search filter panel, if necessary. We'll return to this example in the use case.

Plugin methods vary slightly between Product Search and Guided Selling. However, the different methods for each (isFilterHidden vs. inInputHidden & getFilterDefaultValue vs. getInputDefaultValue) effectively perform the same function.

Date fields are returned as strings in the yyyy-mm-dd format.

Note

Salesforce CPQ executes the implemented methods for Product Search in the following order.

Walkthrough

  1. The Constructor method can be called first, but it’s not required for implementation.
  2. You’ll start off by entering a search field value in the FOREACH method. Salesforce CPQ calls this method for each filter value it receives, then passes those values to the following methods:
    • isFilterHidden: Hides the search filter from the Quote Line Editor if the Quote status is set to approved
    • getFilterDefaultValue: Sets the field value for the initial search
  3. Salesforce CPQ calls isSearchCustom to determine whether you’re using Custom or Enhanced searching.
  4. If isSearchCustom returned True, Salesforce CPQ calls search(). This method gives you full control of the search query - you’ll build the Select Clause and Where Clause manually, then build and perform the query.
  5. If isSearchCustom returned False, Salesforce CPQ calls getAdditionalSearchFilters. This method appends a WHERE clause to the existing SOQL query.

Method Samples

Each method below contains an implementation example. In each example, the SOQL query is from the price book entry table.Constructor
isFilterHidden

Description

Determines the visibility of a filter in the UI. Salesforce CPQ calls this implemented method for each input.

Parameters

Param Type Description
quote SBQQ__Quote__c Current quote object
fieldName String API Name of the Product2 Field

Return Values

Returns TRUE if the field should be hidden in the UI, FALSE otherwise.

Example

getFilterDefaultValue

Description

Determines the input value for the initial search. Salesforce CPQ calls this implemented method for each input field.

Parameters

Param Type Description
quote SBQQ__Quote__c Current quote object
fieldName String API Name of the Product2 field

Return Values

Value to pass for this field in the initial search. NULL if none.

Example

isSearchCustom

Description

Determines if the mode is CUSTOM or ENHANCED. CUSTOM = Full control of Query; ENHANCED = Append additional criteria to WHERE clause.

Parameters

Param Type Description
quote SBQQ__Quote__c Current quote object
fieldValuesMap Map<String,Object> Map of search criteria. Key is Product2 API Name. Value is Value.

Return Values

TRUE for CUSTOM mode. FALSE for ENHANCED mode.

Example

getAdditionalSearchFilters() [Called when isSearchCustom = FALSE]

Description

Appends an extra WHERE clause text when using ENHANCED mode. SOQL query is from the Price Book entry table.

Parameters

Param Type Description
Quote SBQQ__Quote__c Current Quote Object
fieldValuesMap Map<String,Object> Map of search criteria. Key is Product2 API Name. Value is Value.

Return Values

String to be appended to WHERE clause. NULL if none.

Example

search() [Called when isSearchCustom = TRUE]

Definition

Override the entire search when using CUSTOM mode. Product2 fields in the Search Results field set should be set.

Parameters

Param Type Description
quote SBQQ__Quote__c Current Quote Object
fieldValuesMap Map<String,Object> Map of search criteria. Key is Product2 API Name. Value is Value. Only contains Keys for non-NULL values

Return Values

List of Price Book Entries with Product2 external lookup field set

Example

GUIDED SELLING

Salesforce CPQ executes the implemented methods for Guided Selling in the following order:

Walkthrough

  1. The Constructor method can be called first, but it’s not required for implementation.
  2. You’ll start off by entering a search field value in the FOREACH method. Salesforce CPQ calls this method for each filter value it receives, then passes those values to the following methods:
  3. isInputHidden: Hides the search filter from the Quote Line Editor if the Quote status is set to approved.
  4. getInputDefaultValue: Sets the field value for the initial search.
  5. Salesforce CPQ calls isSearchCustom to determine whether you’re using Custom or Enhanced searching.
  6. If isSearchCustom returned True, Salesforce CPQ calls search(). This method gives you full control of the search query - you’ll build the Select Clause and Where Clause manually, then build and perform the query.
  7. If isSearchCustom returned False, Salesforce CPQ calls getAdditionalSearchFilters. This method appends a WHERE clause to the existing SOQL query.
isInputHidden

Description

Determines the visibility of an Input in the UI when using Guided Selling. Salesforce CPQ calls this implemented method for each input.

Parameters

Param Type Description
quote SBQQ__Quote__c Current quote object
input String Name of the Quote Process Input

Return Values

Returns TRUE if the field should be hidden in the UI, FALSE otherwise

Example

getInputDefaultValue

Description

Determines the input value for the initial search. Salesforce CPQ calls this implemented method for each Quote Process Input.

Parameters

Param Type Description
quote SBQQ__Quote__c Current quote object
input String Name of the Quote Process Input

Return Values

Returns a value to pass for this field in the initial search. NULL if none.

Example

isSearchCustom()

Description

Determines if the mode is CUSTOM or ENHANCED when using Guided Selling. CUSTOM = Full control of Query; ENHANCED = Append additional criteria to WHERE clause.

Parameters

Param Type Description
quote SBQQ__Quote__c Current quote object
inputValuesMap Map<String,Object> Map of search criteria. Key is Process Input Name. Value is Value. Only contains keys for non-Null values. Includes additional key "qpid", for the Quote Process ID

Return Values

TRUE for CUSTOM mode. FALSE for ENHANCED mode.

getAdditionalSearchFilters() [Called when isSearchCustom = FALSE]

Description

Appends an extra WHERE clause text when using Guided Selling in ENHANCED mode. SOQL query is from the Price Book entry table.

Parameters

Param Type Description
Quote SBQQ__Quote__c Current Quote Object
fieldValuesMap Map<String,Object> Map of search criteria. Key is Product2 API Name. Value is Value

Return Values

String to be appended to WHERE clause. NULL if none.

Example

search() [Called when isSearchCustom = TRUE]

Definition

Override the entire search when using in CUSTOM mode. Product2 Fields in the Search Results field set should be set.

Parameters

Param Type Description
quote SBQQ__Quote__c Current Quote Object
fieldValuesMap Map<String,Object> Map of search criteria. Key is Product2 API Name. Value is Value. Only contains Keys for non-NULL values

Return Values

List of Price Book Entries with Product2 external lookup field set

Example