Filter Account List
  • 23 May 2024
  • 1 Minute to read
  • Dark
    Light

Filter Account List

  • Dark
    Light

Article summary

Purpose

Allows you to run a script that filters the list of accounts that are shown when creating a quote.

Setup

Upload the script for Filter Account List.

For details about uploading and configuring Groovy scripts, read Upload a Groovy script.

Binding variables

In addition to the common binding variables, the following binding variables are available for this extension point.

Variable nameClassDescription
filterAccountScriptCollection<Condition>Set of filter conditions that apply to the account list
filterFactoryFilterFactoryHelper class for creating the conditions

Expected output

The script fills in the filterAccountScript variable with the appropriate conditions, which are then used to filter the account list for quote creation.

Conditions may be created with the help of the filterFactory variable or instantiated directly by the script. Refer to the Javadoc for available subtypes of the Condition interface that can be added to the filterAccountScript variable.

If multiple conditions are added, the account must meet all of them to pass the filter. There is currently no support for OR operation for multiple conditions. Within one condition, however, it is often possible to specify multiple inputs; these are evaluated as either-or, as illustrated by the following script snippet:

// 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 are shown in quote creation

Script execution

The script runs automatically when a new quote is created through the user interface. The list of accounts that can be selected in the Create Quote screen are filtered according to the script.

If no script is uploaded for this extension point, or the script has an error, the system makes all accounts available for selection (the default behavior).


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.