Product Picker Filter Logic

You will use a Product Picker Filter logic when you need to:

  • Limit the list of products presented to the business user, when they click on:

    • The product input field.

    • The product group input field.

When the Logic Is Called

  • From Product input field - automatically by the system, at the moment, when the user opens the Product picker.

  • From Product Group input field - automatically by the system, at the moment, when the user opens the Product picker.

  • From a logic, by calling the method api.evalProductFilterLogic(). This could be useful, if you need to call one filter logic from inside another one - e.g., when combining more filter logic results together.

Note that formerly it was possible to build the product input field on the line item also by calling the method api.product() in the Input Generation mode. There’s a version of the api.product() method, which supports adding of the filter too - sample: api.product("sku", null, "ProductInputFilter", salesOrganization).

Logic API

  • Logic Nature: productInputFilter

    • Logic Type: Calculation/Pricing

  • Execution Types:

    • Standard - To calculate the filters to be used in the product picker.

  • Information provided to the logic:

    • In the Standard mode:

      • Binding variable filterFormulaParam will contain the text provided, when the logic was called. Commonly, if more than one value was needed to pass via the param, the values are passed as a Map, which is encoded as JSON text. In such case, you will need to decode the string before using.

        • In case it’s called from the input field, the value of filterFormulaParam is provided in the definition of the input field.

        • When called from api.evalProductFilterLogic(), the value of parameter is provided in the function call.

  • Expected logic execution outcome:

    • From Standard mode execution

      • The system will collect results of the logic elements, which return an object of type Filter (result values of other types are ignored). All those filters will be placed to a List and such List<Filter> will be used as a result of the logic.

        • Note, that the Display Mode is ignored in this logic.

Sample

Sample of logic of nature CustomerInputFilter
def param = api.jsonDecode(filterFormulaParam) def countryUnit = param?.CountryUnit def custCorpGrpNo = param?.CustCorpGrpNo List filters = [] if (countryUnit) { filters.add(Filter.equal("attribute1", countryUnit)) } if (custCorpGrpNo) { filters.add(Filter.equal("attribute9", custCorpGrpNo)) } if (filters.isEmpty()) { return null } return Filter.and(*filters)
Sample of input field definition, which uses the filter logic
Map filterParam = [ CountryUnit: countryUnit.getValue(), CustCorpGrpNo: corpGrp.getValue() ] def customerInputFieldBuilder = api.inputBuilderFactory() .createCustomerEntry("Customer") .setLabel("Customer") .setFilterFormulaName("CustomerPickerFilter") //❶ .setFilterFormulaParam(api.jsonEncode(filterParam))

❶ The name of the CustomerInputFilter logic.

Found an issue in documentation? Write to us.