This Extension Point allows a script to filter the list of accounts that would be shown when creating a new Quote.
Initial Setup
Upload the script file to the Groovy Script with the name “Filter Account List”. Please refer to Groovy Service Introduction - Uploading a New Groovy Script for more details of how to do this.
// include only accounts that belong to either Automotive or Manufacturing industry
def condition1 = filterFactory.getCondition(Schema.Industry, Schema.hasIndustry,
Schema.objectName, ["Automotive", "Manufacturing"], OPERATOR.CONTAINS);
filterAccountScript.add(condition1);
// include only accounts that has "GRP1" account group
def condition2 = new ConditionAttribute(Schema.accountGroup, "GRP1",
OPERATOR.CONTAINS);
filterAccountScript.add(condition2);
def attribute Chain = Lists.newArrayList(//
Pair.of(Schema.definesSalesInfo, Schema.SalesInfo),//
Pair.of(Schema.hasSalesOrg, Schema.SalesOrg));
Condition c = filterFactory.getConditionChain(//
attributeChain, filterFactory.getCondition(Schema.objectERPId, "1000", OPERATOR.EQUAL));
filterAccountScript.add(c);
// only accounts that meet both of these conditions will be shown in quote creation
Additional Binding Variables
The following binding variable(s) are made available for this extension point, in addition to the common binding variables listed in Groovy Service Introduction - Common Binding Variables.
Variable Name |
Class |
Description |
---|---|---|
filterAccountScript |
Collection<Condition> |
The set of filter conditions that would be applied to the account list |
filterFactory |
FilterFactory |
A helper class for creating the Conditions |
Expected Output
The script is not expected to return anything. However, it is expected to fill in the filterAccountScript variable with the appropriate conditions that would then be used to filter the account list for Quote creation.
The conditions may be created with the help of the filterFactory variable, or they may also be instantiated directly by the script. Please refer to the Javadoc for the available subtypes of the Condition interface that can be added to the filterAccountScript variable.
If multiple conditions are added, the account would have to fulfill all of them to pass the filter, i.e. they are merged with the AND operation. There is currently no support for OR operation for multiple conditions. Within one condition, however, it is often possible to specify multiple inputs, and these are evaluated as either-or. The following script snippet illustrates this. Please refer to section 6.4 Filtering Account List during Quote Creation for the full example.
Script Execution
The script that has been uploaded for this extension point will be executed automatically when a new Quote is created through the GUI. The list of Accounts that can be selected in the Create Quote screen will be filtered according to the script.
If no script has been uploaded for this extension point yet or if the script has an error, nothing will be filtered, and the system will fall back to the default behavior such that all Accounts in the system will be available for selection.
Comments
0 comments
Article is closed for comments.