You’re using Customer Picker Filter logic when you need to:
-
limit the list of customers presented to the business user, when they click on
-
the customer input field
-
the customer group input field
-
When the logic is called
-
from Customer input field - automatically by the system, at the moment, when the user opens the Customer picker
-
from Customer Group input field - automatically by the system, at the moment, when the user opens the Customer picker
-
from a logic, by calling method api.evalCustomerFilterLogic(). 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 method api.customer() in the Syntax Check mode. There’s a version of the api.customer() method, which supports adding of the filter too - sample: api.customer("customerId", null, false, "CustomerInputFilter", salesOrganization)
Logic API
-
Logic Nature: customerInputFilter
-
Logic Type: Calculation/Pricing
-
-
Execution Types:
-
Standard - to calculate the filters to be used in the customer 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.evalCustomerFilterLogic(), 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
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)
Map filterParam = [ CountryUnit: countryUnit.getValue(), CustCorpGrpNo: corpGrp.getValue() ] def customerInputFieldBuilder = api.inputBuilderFactory() .createCustomerEntry("Customer") .setLabel("Customer") .setFilterFormulaName("CustomerPickerFilter") //❶ .setFilterFormulaParam(api.jsonEncode(filterParam))
❶ name of the CustomerInputFilter logic