--- title: "Filter Product List" slug: "filter-product-list" description: "Use this extension point to limit the products displayed to a user in CPQ or eCommerce based on custom assortment conditions." updated: 2026-06-02T12:38:09Z published: 2026-06-02T12:38:09Z canonical: "docs.zilliant.com/filter-product-list" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.zilliant.com/llms.txt > Use this file to discover all available pages before exploring further. # Filter Product List ## Purpose Allows you to run a script to limit the products displayed to a user in [CPQ](/v1/docs/cpq) or [eCommerce](/v1/docs/about-ecommerce) based on custom assortment conditions. For example, you can configure CPQ or eCommerce to display products based on the user's associated account attributes, such as **Account Group**, **Industry**, or whether the account is a prospect. ## Setup Upload the script for **Filter Product List**. For details about uploading and configuring Groovy scripts, read [Upload a Groovy script](/docs/upload-a-groovy-script). Additionally, you can leverage [lookup tables](/v1/docs/lookup-tables) to easily manage and maintain assortment-relevant data and streamline the customization process. To leverage lookup tables, use one of the following methods: - While uploading your script in CPQ, enter lookup table names in the **Lookup Tables** field. - Query lookup tables in your [Groovy script file](/v1/docs/filter-product-list#script). ## Script In your script: - Import necessary [binding variables](/v1/docs/filter-product-list#binding-variables). - Use the `ConditionAggregateAND` and `ConditionAggregateOR` classes to define conditions. - Use the `groovyCtxUtil.isCommerce()` class to differentiate between CPQ and eCommerce. For details about the classes, including available methods, fields, and method signatures, read the [Zilliant Groovy API reference](/main/docs/groovy-api-reference). ****Sample script**** ```groovy import com.imc.context.filters.ConditionAttribute; import com.imc.context.filters.Condition.OPERATOR; import com.imc.context.filters.Condition; import com.google.common.collect.Sets; import com.imc.vocabulary.Schema; import com.imc.iss.groovy.salesitem.SalesItemsTree; import com.imc.iss.groovy.lookupTable.GroovyLookupTable; import com.imc.util.NullUtil; import org.apache.commons.lang3.StringUtils; import com.imc.datamodel.BusinessType; import org.apache.commons.lang3.tuple.Pair; import org.apache.jena.ext.com.google.common.collect.Lists; import com.imc.datamodel.BusinessRelationAttribute; import com.imc.iss.groovy.orgUnit.OrgUnit; import com.imc.iss.groovy.GroovyCtxUtil; import com.imc.iss.groovy.orgUnit.OrgUnitHierarchy; import com.imc.datamodel.BusinessObject import com.imc.context.filters.ConditionAggregate import com.imc.context.filters.ConditionAggregateAND import com.imc.context.filters.ConditionAggregateOR /* * * Groovy implementation of product filtering *     *  Binding variables *  groovyLogger : GroovyLogger *  groovyCtxUtil : GroovyCtxUtil *  filterProductScript : Collection *  userInfo : UserInfo *  employee : Employee *  contact  : Contact *  account  : Account *  dbLookupTable : GroovyLookupTable */ def productCategoryList = []; def materialGroupList = []; ConditionAggregateAND conditionAggregateAND1 = new ConditionAggregateAND(); ConditionAggregateAND conditionAggregateAND2 = new ConditionAggregateAND(); ConditionAggregateOR conditionAggregateOR = new ConditionAggregateOR(); // Returns true if it's an eCommerce user. groovyLogger.logDebug("Is this the Commerce User : "+ groovyCtxUtil.isCommerce()); // Get the user binding variable. String username = userInfo.getUsername(); String userURI = userInfo.getUserBO().getUriAsString(); groovyLogger.logDebug("UserInfo user name : "+ username); if(groovyCtxUtil.isCommerce() && binding.hasVariable('contact')) {    // eCommerce Product filter    // Get the contact binding variable.    String contactName = contact.getContactDataAttributeValue("http://www.inmindcloud.com/application/schema.owl#objectName");    // Get the account binding variable.    String accountGroup = account.getAccountDataAttributeValue("http://www.inmindcloud.com/application/schema.owl#accountGroup");    // Query the lookup table.    def rawData = dbLookupTable.table('PRODUCT_FILTER_URI').addSelectFields('account_group', 'product_category', 'material_group').addCondition('account_group', '==', accountGroup).search();    rawData.each { line ->        def productCategory = line['PRODUCT_CATEGORY']        def materialGroup = line['MATERIAL_GROUP']                if (!NullUtil.isNullorEmpty(productCategory)) {            productCategoryList.add(productCategory)        }                if (!NullUtil.isNullorEmpty(materialGroup)) {            materialGroupList.add(materialGroup)        }    }        Condition condition01 = filterFactory.getCondition(Schema.Product, Schema.hasProductClassification, Schema.objectName, "Product", OPERATOR.EQUAL);    conditionAggregateAND1.and(condition01);        if (productCategoryList.size() > 0)    {        Condition condition02 = filterFactory.getCondition(Schema.Product, Schema.linksProductCategory, Schema.objectName, productCategoryList, OPERATOR.EQUAL);        conditionAggregateAND1.and(condition02);    }            Condition condition03 = filterFactory.getCondition(Schema.objectERPId, "BT" , OPERATOR.EQUAL);    conditionAggregateAND2.and(condition03);    if (materialGroupList.size() > 0)    {        Condition condition04 = filterFactory.getCondition(Schema.Product, Schema.hasProductMaterialGroup, Schema.objectName, materialGroupList, OPERATOR.EQUAL);        conditionAggregateAND2.and(condition04);    }    // Final condition setup.    conditionAggregateOR.or(conditionAggregateAND1)    conditionAggregateOR.or(conditionAggregateAND2)        if (!conditionAggregateAND1.getConditions().isEmpty()){        filterProductScript.add(conditionAggregateOR);    } } else {    // CPQ Product filter    // Get the employee binding variable.    String employeeName = employee.getEmployeeDataAttributeValue("http://www.inmindcloud.com/application/schema.owl#objectName");    // Query the lookup table.    def rawData = dbLookupTable.table('PRODUCT_FILTER_URI').addSelectFields('account_group', 'product_category', 'material_group').addCondition('account_group', '==', accountGroup).search();    rawData.each { line ->        def productCategory = line['PRODUCT_CATEGORY']        def materialGroup = line['MATERIAL_GROUP']                if (!NullUtil.isNullorEmpty(productCategory)) {            productCategoryList.add(productCategory)        }                if (!NullUtil.isNullorEmpty(materialGroup)) {            materialGroupList.add(materialGroup)        }    }    if (productCategoryList.size() > 0)    {        Condition condition01 = filterFactory.getCondition(Schema.Product, Schema.linksProductCategory, Schema.objectName, productCategoryList, OPERATOR.EQUAL);        conditionAggregateAND1.and(condition01);    }        if (materialGroupList.size() > 0)    {        Condition condition02 = filterFactory.getCondition(Schema.Product, Schema.hasProductMaterialGroup, Schema.objectName, materialGroupList, OPERATOR.EQUAL);        conditionAggregateAND1.and(condition02);    }        if (!conditionAggregateAND1.getConditions().isEmpty()){        filterProductScript.add(conditionAggregateAND1);    } } ``` ## Binding variables In addition to the [common binding variables](/docs/binding-variables), the following binding variables are available for this extension point. | Variable name | Class | Description | | --- | --- | --- | | filterProductScript | Collection | Adds a collection of aggregate conditions. This variable is returned at the end of the Groovy script. | | employee | Employee | Contains the employee information. Use this variable only for CPQ. | | contact | Contact | Contains the contact information. Use this variable only for eCommerce. | | account | Account | Contains the account information. Use this variable only for eCommerce. | For details about the classes listed in this table, including available methods, fields, and method signatures, read the [Zilliant Groovy API reference](/main/docs/groovy-api-reference). ## Expected output No output expected. ## Script execution A script that you upload for this extension point runs automatically when users open a product listing or catalog while performing such actions as placing an order in eCommerce or creating a quote or agreement in CPQ. If no script is uploaded for this extension point, users see all products in CPQ or eCommerce.