Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
4 replies
Subscribers
8 subscribers
Views
1708 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
I have an expression rule that implements a common component that is going to be
mikej117
over 9 years ago
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
0
abhi.jana
Appian Employee
over 9 years ago
What context are you using? If it's for a user then the loggedinuser() function could be included in the expression
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mikej117
over 9 years ago
The context is more about the functionality that is being implemented in each form.
The common component allows the user to select a valid employee (based on a web service call). One form uses it without any extra validation, whilst another form uses it with additional constraints (such as whether that employee was already applied to another task). The extra validation is based on local variable data inside the calling form.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Conor Cahill
Certified Lead Developer
over 9 years ago
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.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mikej117
over 9 years ago
Thanks for your suggestions guys. It sounds like there isn't an easy way to keep the specific logic outside of the custom component. I was hoping for a nice way to implement a callback or something similar.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel