Lookup Filter Plugin
Refer the article to apply filter logic to both managed and custom lookup fields within the Quote Object.
Quote Studio provides the capability to apply filter logic using plugins for both managed packaged lookup fields and custom lookup fields established within the Quote Object, including fields like Bill to Contact, Sold to Contact, Opportunity, etc.
Use the ILookupFilter on the LookupFilterPlugin component to add filters into Lookup fields that are released with the CPX package. Ex, Sold To Contact, Bill to Contact, Opportunity, etc.
The plugin interface is defined as:
global zqu.LookupFilterPlugin.ILookupFilter
The plugin contains the following interface methods.
|
Return Type |
Method |
Input Parameters |
|---|---|---|
|
zqu.LookupFilterPlugin.LookupFilter |
getFilter |
zqu.LookupFilterPlugin.FilterRequest |
zqu.LookupFilterPlugin.LookupFilter
All field names are case sensitive.
|
Field |
Description |
|---|---|
|
objectName |
To add “And/or” conditions, the default consideration is an "AND" condition. Example 1: ((1 OR 2) AND 3) Example 2: (1 OR 2) Example 3: (1 AND 2) |
|
List<FilterField> filters |
For FilterField, see zqu.LookupFilterPlugin.FilterField . |
|
List<String> searchFields |
Field names to search and display records in Lookup Fields. You can use up to three fields. Note:
Once you select a value in Quote Studio, hovering over the lookup field displays all three field values of the selected lookup record. |
zqu.LookupFilterPlugin.FilterField
Catalog of filters that will sort out records.
|
Property |
Description |
Type |
|---|---|---|
|
objectName |
The object's name for which filtering is required. |
String |
|
fieldName |
The name of the field within the object that needs to undergo filtering |
String |
|
fieldValue |
The value used for filtering |
String or List<String> |
|
Operator |
The operator condition . | |
Example Use Cases
Example 1: Filter Contacts with a Type__C value equal to 'SoldTo'
filter.filters.add(new zqu.LookupFilterPlugin.FilterField('Contact','Type__c', 'SoldTo', zqu.LookupFilterPlugin.Operator.EQUAL));
Example 2: Filter Opportunities where the AccountId matches the accountId of the current Quote
string accountId = (string) request.sourceObject.get('zqu__Account__c');
filter.filters.add(new zqu.LookupFilterPlugin.FilterField('Opportunity', 'AccountId', accountId, zqu.LookupFilterPlugin.Operator.EQUAL));
zqu.LookupFilterPlugin.Operator
The following operators are supported:
-
EQUAL
-
NOT_EQUAL
-
GREATER_THAN
-
GREATER_OR_EQUAL
-
LESS_THAN
-
LESS_OR_EQUAL
-
CONTAINS
-
NOT_CONTAINS
-
START_WITH
-
INCLUDE_IN
zqu.LookupFilterPlugin.FilterRequest
|
Field |
Description |
|---|---|
|
filterCondition |
The name of the object for which the filter is invoked. Currently, it exclusively supports |
|
fieldName |
The name of the field for which the filter is invoked, such as |
|
sourceObject |
This field contains the values for which the filter is invoked. It can be utilized to obtain the necessary values for constructing the filter. |
Example
Let's consider a scenario where you intend to filter Opportunities based on the current Quote's account. In this case, you retrieve the account ID using the source object.
string accountId = (string) sourceObject.get('zqu__Account__c');