Apply rule based on condition

Hi community!

How are you?

How can I apply a rule only if a condition is met? In this case, if the logged-in user has the CASACENTRAL organizational role, the rule does not apply, otherwise the rule will apply

"UpriNino": {
      FiltrarRegionNinoPorRegionJI: {
            ruleType: BusinessRuleModule.enums.RuleType.FILTRATION,
            //autocomplete: true,
            autoClean: true,
            baseAttributePatch: "UpriRegion",
            comparisonType: Terrasoft.ComparisonType.EQUAL,
            type: BusinessRuleModule.enums.ValueType.ATTRIBUTE,
            attribute: "UpriEstRegion"
      }
 },

 

if the user has the CASACENTRAL role, there should not be any filter in the UpriNino field

I hope your can help me!

King Regards

Ezequiel!

Like 0

Like

4 comments

Dear Ezequiel,

Check the manual from our SDK that provide the examples of setting up the conditions for the business rules - https://academy.bpmonline.com/documents/technic-sdk/7-12/bindparameter-rule-how-make-field-required-based-specific-condition

Lisa

Dear Lisa,

Thanks you for your response.

In this case, the rule type is "FILTRATION". I don't have the possibility of set a conditions array for decide if the rule apply or not. Is that so?

How can I do it?

King Regards,

Ezequiel

 

Dear Ezequiel,

There is no option to configure if the rule is applied based on the condition. You can add the JS-code to the page schema that will accomplish the same task as the business rule. You can find the example of such code in the SDK and then customize it by adding the current user role check. 

Lisa

Dear Lisa,

Thanks you for your response.

Finally, add the attribute wiht fitration to attributes property of view modelm and there i put the logic!

Regards,

Ezequiel

Show all comments