Product Search Plugin
| Available in: All Salesforce CPQ Editions |
- 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.
Product search plugins can use only a subset of Quote fields by default. If you can't pass a field to your product search, or if it passes as null, you must instead pull it with a SOQL query using the ID passed with the quote model.
Walkthrough
- The Constructor method can be called first, but it’s not required for implementation.
- 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
- Salesforce CPQ calls isSearchCustom to determine whether you’re using Custom or Enhanced searching.
- 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.
- If isSearchCustom returned False, Salesforce CPQ calls getAdditionalSearchFilters. This method appends a WHERE clause to the existing SOQL query.
Method Samples
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
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
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
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
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
Salesforce CPQ executes the implemented methods for Guided Selling in the following order:
Walkthrough
- The Constructor method can be called first, but it’s not required for implementation.
- 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:
- isInputHidden: Hides the search filter from the Quote Line Editor if the Quote status is set to approved.
- getInputDefaultValue: Sets the field value for the initial search.
- Salesforce CPQ calls isSearchCustom to determine whether you’re using Custom or Enhanced searching.
- 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.
- If isSearchCustom returned False, Salesforce CPQ calls getAdditionalSearchFilters. This method appends a WHERE clause to the existing SOQL query.
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
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
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.
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
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