Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Sample

Code Block
languagegroovy
themeMidnight
titleSample of a logic of nature CustomerInputFilter
linenumbersfalse
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
languagegroovy
themeMidnight
titleSample of definition of input field, which uses the filter logic
linenumbersfalse
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.

Info