This is the documentation for Clover Club 12.0.
Documentation for the upcoming version Rampur 13.0 can be found here.
Agreements & Promotions - Condition Type Filter Logics
In this section you can define a logic that will be applied in the Condition Type picker when adding agreement terms 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; for the resulting filter they are joined using the AND operator.
In order for the logic to be used, it must be set as Active and be valid at the time of adding the Condition Type to the Agreement/Promotion.
From the Default Condition Filter Logic drop-down list, you can select one of the logics as default. This default logic will be used if there is no filter logic associated with an Agreement & Promotion Type. If there is no logic marked as default and no filter logic is associated with the Agreement & Promotion Type, no filter logic will be applied.
Example Logic
In the filter logic, we can have a single element as show below. It demonstrates how to write the logic if the entitlement is done through data stored in the userGroupViewDetails
field. The filter looks like this since userGroupViewDetails
is a single field containing all groups as a single string joined by a comma.
//api.logInfo("contract", contract)
def userGroups = api.user().groups.collect{ it.uniqueName }
//api.logInfo("user", userGroups)
def filter = Filter.isNull("userGroupViewDetails")
if (userGroups == null || userGroups.isEmpty()) {
return filter
} else {
def filters = [filter]
filters.addAll(userGroups.collect {
Filter.like("userGroupViewDetails", "%" + it + "%")
})
return Filter.or(*filters)
}