Item Picker Filters

This article describes how to develop filtering for new items (e.g., products) in relationship to Quotes, Rebates and Promotions that will limit the items displayed to a user when adding new item, to a pre-defined filtering condition.

Quote Product Filters

Using Product Filters

When creating Quotes, we have the ability to create a filter for Products when we are selecting a product for a new line in the Quote.

Additionally, a similar kind of filter logic can also be created for Agreements/Promotions and for Rebates (i.e., filter Condition Types when adding new line to Agreement/Promotion or Rebate Agreement).

From high-level perspective, the principle is the same, with the difference that the Nature of the logic is different and the Filter will be applied to Agreement & Promotion or Rebate Condition Type.

  • When creating a quote that is valid from the time period 2021-01-01 — 2021-01-10, a Sales Manager wants to have a list of Products filtered by BusinessUnit, so that I see only relevant products when creating my Quote and adding products to it.

Quote Product Filters

There’s a Filter applied on the list of Products (which is used to select product for new line item in the Quote).

  • The Filter limits the list of products only to the products which belong to the Business Unit selected by the user in the input field "Business Unit".

  • If no Business Unit selected by the user on the quote header, all products are available.

  • The product Filter is applied only to Quotes of type {quote-type}.

Use of Quote Product Filters

We need to create new Pricing Logic that uses the formula nature of "quoteProductFilter":

The DisplayMode does not matter here - you can keep it on "Never".

The results of all Elements are expected to be used for filtering (when more Elements return a Filter, the filters are ANDed), so if you want to have some Element only as a "helper" elements, which should NOT be used as a filter, ensure they do not return a Filter. Ideally let them return null.

Below we see an example of the product filtering Groovy code that will filter against the BusinessUnit attribute of a product:

if (quote.quoteType == "QuoteProductFilter_QuoteType") { //❶ def businessUnit = quote.inputs //❷ ?.find { it.name == "BusinessUnit" }?.value return Filter.equal("attribute2", businessUnit) //❸ }

❶ If you have more quote types on your partition, remember to apply your filter only for the required type of quote, otherwise it will be used for ALL types of quote.
❷ You can access the quote data via the "quote" binding variable, which is a "map" and contains the whole content of the quote.This is a similar approach as you could see e.g., in Workflow logics.
❸ WARNING: The filter cannot use the names provided by configuration of Product Master columns, you MUST use here the actual names of the columns like "attribute2"=== Use of Quote Product FiltersWhen we navigate to Quoting  Quotes and choose the New Quote of type {quote-type}

Then, on the Header tab (in the section with Input Parameters), locate the drop-down input field Business Unit, and select the desired type of products you’re going to use on the line items (e.g., "Extra").

On the tab Items, click on the arrow on left from "Search and add products" to show the list of products.

We should ensure the list is properly limited and we should experiment with different values of the input (ie., Business Unit) and always verify that the list of available products is filtered accordingly.

Agreement & Promotion Condition Type Filters

Using Agreement & Promotion Condition Type Filters

We can define a logic that will be used in the Agreement & Promotion Condition Type picker when adding Conditon Types to an Agreement/Promotion. When users create a new Agreement/Promotion and start adding Condition Types, they will see only a subset of Condition Types based on the logic results. The logic can have multiple elements and for the resulting filter they are joined using the AND operator.

Examples of the Groovy code would be:

Build filter based on input fields of the Agreement/Promotion header
def contractType = contract.inputs.find { it.name == "RContractType" } if (contractType) { return Filter.equal("attribute5", contractType?.value) }
Build filter based on types of lines in the Agreement/Promotion
def logisticDiscount = contract.lineItems.findAll { it.contractTermType == "LogisticDiscount" }.size() def statusDiscount = contract.lineItems.findAll{ it.contractTermType == "StatusDiscount" }.size() def ctts = [] if(logisticDiscount > 0) ctts.add("LogisticDiscount") if(statusDiscount > 0) ctts.add("StatusDiscount") return Filter.notIn("uniqueName", ctts)

Rebate Condition Type Filters

Using Rebate Condition Type Filters

We can define a logic that will be used for filtering in the picker for Rebate Condition Types. When users create a new Rebate Agreement and start adding Condition Types, they will see only a subset of Condition Types based on the results of this filtering logic.

References

Documentation (Unity)

Documentation (Classic)

Found an issue in documentation? Write to us.