BusinessRuleModule by two columns

Question

Can we create a business rule that would process column attribute modifications (e.g., the "required" checkbox) by two collumns?

Answer

Below is an example of a business rule that makes the “UsrRequired” field required for population only in case the "UsrText0" and "UsrText1" fields are unpopulated:

rules: {
    "UsrRequired": {
        BindParameterRequiredAccountByType: {
            ruleType: BusinessRuleModule.enums.RuleType.BINDPARAMETER,
            property: BusinessRuleModule.enums.Property.REQUIRED,
            logical: Terrasoft.LogicalOperatorType.AND,
            conditions: [
                {
                    leftExpression: {
                        type: BusinessRuleModule.enums.ValueType.ATTRIBUTE,
                        attribute: "UsrTest0",
                    },
                    comparisonType: Terrasoft.ComparisonType.EQUAL,
                    rightExpression: {
                        type: BusinessRuleModule.enums.ValueType.CONSTANT,
                        value: ""
                    }
                },
                {
                    leftExpression: {
                        type: BusinessRuleModule.enums.ValueType.ATTRIBUTE,
                        attribute: "UsrTest1",
                    },
                    comparisonType: Terrasoft.ComparisonType.EQUAL,
                    rightExpression: {
                        type: BusinessRuleModule.enums.ValueType.CONSTANT,
                        value: ""
                    }
                }
            ]
        }
    }
},

 

Like 0

Like

Share

0 comments
Show all comments