Pricefx Classic UI is no longer supported. It has been replaced by Pricefx Unity UI.

 

How to Set Logic Based Customer Input Filter

When using the standard customer input, it is also possible to define a customer filter based on a logic. With this flexible filter you can limit which customers a user can select in a picker that is shown after clicking the magnifying glass icon:

Sample use case: A user acts on behalf of another user and you want to narrow down the selection of customers shown in the customer picker – based on the selected sales user. For example, a sales office assistant creates Quotes/Agreements/Promotions on behalf of multiple sales reps and when doing that, he/she can select only customers assigned to the given sales rep.

Filter Setup

The logic-based customer picker filter is employed in the customer input. You need to define a logic in Price Setting which creates a customer filter for the customer input definition. 

On the header level use the addOrUpdateInput method:

cProcessor.addOrUpdateInput("ROOT", [ name : "Customer3", label : "Customer3", type : "CUSTOMER", filterFormula : [name : "myLogic", param: cProcessor.getContractView().typedId] ])

where:

  • filterFormula.name is uniqueName of the logic 

  • filterFormula.param is a string param that will be passed back to the client which will resend it back to the server when going to fetch customer's data. This value can be used in your Customer Input Filter logic as a base for customer filter.



On the item level: 

api.customer("customerId", null, false, "myLogic", "1.CT") /*myLogic is logic uniqueName and "1.CT" represents filterFormulaParam and will be available in the logic that will generate the filter*/



myLogic is a logic with the Customer Input Filter nature and it contains just a single element:

def contract = api.getCalculableLineItemCollection(filterFormulaParam) // filterFormulaParam is the param from the logics above, injected to this logic api.logInfo("contract", contract) Filter.like("customerId", "CD-0000%")



The filterFormulaParam is the "param" set in the header or line item logic.

In the logic which creates the filter, you can use semi-joins (subselects) to the Customer Extension tables to able to filter customers based on data there.

The syntax is:

This logic must be assigned the 'Customer Input Filter' nature in the UI.

Filter Setup in Configurators

To implement this type of customer filter in configurators you need the ContextParameter method addParameterConfigEntry. This is because configurators do not have access to any cProcessor or quoteProcessor type objects at the header level.



Found an issue in documentation? Write to us.