Rule Types

Business rules are used to enforce more complex requirements that a product and its attributes must meet.

We currently support the following types of business rules:

TypeDescription
Groovy ruleRuns a snippet of groovy code. This is the most flexible type of rule
Conditionally required ruleIf an expression referencing a set of attributes is true, then attribute X is required
Dependent attribute ruleIf attribute A meets condition, then attribute B is required
Uniqueness validation ruleChecks if all products across a channel have unique combination of values on a specified subset of its attributes

Builders for all types, except uniqueness validation, allow us to control:

Attribute type idType specific parameters
idRule ID that will show up in the error popup in PDX UI
categoriesA list of categories that the rule applies to. If this list is empty, the rule will be applied globally for all categories.
executionDetermines how the rule is executed. The list of values is found in BusinessRule.ExecutionEnum and are: CONTINUOUS (default), SUBMISSION, AUTOSUBMIT, and ALL

Code Example:

BusinessRule rule = BusinessRuleBuilder.groovyRule("ID")
    .withCategories("categoryA", "categoryB")
    .withExecution(BusinessRule.ExecutionEnum.SUBMISSION)
    ... // add rule specific options here
    .build();