You’re using You will use a Customer Picker Filter logic when you need to:
limit Limit the list of customers presented to the business user, when they click on:
the The customer input field.
the The customer group input field.
When the
logic is calledfromLogic Is Called
From Customer input field - automatically by the system, at the moment , when the user opens the Customer picker.
from From Customer Group input field - automatically by the system, at the moment , when the user opens the Customer picker.
from From a logic, by calling the 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 the 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 In the Standard mode:
binding 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 In case it’s called from the input field, the value of filterFormulaParam is provided in the definition of the input field.
when When called from api.evalCustomerFilterLogic(), the value of the parameter is provided in the function call.
Expected logic execution outcome:
from From Standard mode execution:
the The system will collect the 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
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
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) |
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Map filterParam = [ CountryUnit: countryUnit.getValue(), CustCorpGrpNo: corpGrp.getValue() ] def customerInputFieldBuilder = api.inputBuilderFactory() .createCustomerEntry("Customer") .setLabel("Customer") .setFilterFormulaName("CustomerPickerFilter") //❶ .setFilterFormulaParam(api.jsonEncode(filterParam)) |
❶ name Name of the CustomerInputFilter logic.