Dependent attribute rule
The dependent attribute rule builder has the following additional properties:
Property | Description |
---|---|
condition | Condition consists of a pair of an attribute ID and a condition value. The condition value can be one of the following: • any non-empty string that contains the value that the condition attribute must have, e.g. "Yes" • the string "*" which means that condition attribute contains any non-empty value |
dependent attribute | The attribute that is required to be non-empty when condition is satisfied |
error message | The error message that will show up in PDX UI if expression is true, but conditional attribute was not set to a value |
Code Example:
BusinessRule rule = BusinessRuleBuilder.dependentAttributeRule("RULE_ID")
.withCondition("COMPANY_NAME_ATTRIBUTE_ID", "PDX")
.withDependentAttribute("PDX_INFO")
.withErrorMessage("When company name is PDX, then PDX-info is required")
.build();
This produces the following JSON output when rule is serialized:
{
"id": "RULE_ID",
"templateId": "dependentAttribute",
"errorMessage": "When company name is PDX, then PDX-info is required",
"namedAttributes": {},
"parameters": {
"dependentAttribute": "PDX_INFO",
"conditionAttribute": "COMPANY_NAME_ATTRIBUTE_ID",
"conditionValue": "PDX"
},
"requiredContexts": [],
"execution": "CONTINUOUS",
"businessRuleScopes": [],
"staticProperties": {}
}
Updated over 1 year ago