8. Add new dynamic attribute to Custom Filter

Prerequisites

  • You already went through the previous cookbook 7. Modify Line Item Key on the Fly.

  • You are familiar with how <<FIELD_NAME()>> and <<TARGET_DATE>> OoTB dynamic attributes work in Custom Filter.

Step 0: Task

I want to create a custom filter based on another variable available in my logic. For example PriceListId. On algorithmic level, I need to know the following:

  • What is the value I want to create Filter against?

Step 1: Prepare Lookup Configuration

To implement the above information, we will:

  • Modify ConfigurableLookup library to add dynamic tag resolution

    • Go into ConfigurableLookupsLib Library → ConfigProcess element.

      • Find empty Closure under replaceCustomAttributes Map key.

      • Write a script where you replace your tag with live value as docs suggest:

         replaceCustomAttributes: { String filter ->
                        /**
                         * If you need to perform lookup based on some custom variable (e.g. PL/PG id), you can modify your stringified filter here.
                         * Example: filter = filter.replace("<<priceListId>>", out.priceListId)
                         */
        
                        return filter
                        }
        
  • Now you can use your attribtue in “Custom Filter” column of LookupConfiguration PP 

Step 2: Call Lookup Library

Calling lookup library has not changed from the previous cookbook.

Step 3: Read Results

Reading results have not changed since the previous cookbook.