I have an expression rule that implements a common component that is going to be

I have an expression rule that implements a common component that is going to be called from multiple forms. While the bulk of this component is common, there are some context-specific parts to it, such as custom validation, which depends on the context.
What I would like to do is to pass some custom validation code into the common component rule. What is the best way to go about doing this?

OriginalPostID-150902

OriginalPostID-150902

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    You could pass in an integer or string that tells the common component which form you are calling it from. This way you can have all the custom validation in the common component, and you just conditionally check some of it depending on the form-type parameter that was passed to it.

    You won't be able to access and use the rule's local variables from outside the rule, so you'd have to implement all the constraints within the rule. My solution allows you to choose which constraints you'll actually validate.
Reply
  • 0
    Certified Lead Developer
    You could pass in an integer or string that tells the common component which form you are calling it from. This way you can have all the custom validation in the common component, and you just conditionally check some of it depending on the form-type parameter that was passed to it.

    You won't be able to access and use the rule's local variables from outside the rule, so you'd have to implement all the constraints within the rule. My solution allows you to choose which constraints you'll actually validate.
Children
No Data