RunIf Expressions
Most Entities support RunIfExpressions.
If specified, the expressions are executed every time an Entity is called through the API, and they must return true or false. If they return true the access is allowed and the execution takes place, otherwise an error is returned.
Note that when calling an API endpoints, checks happen in the following order:
- Security roles
- Dimension Gating (if specified)
- runIf expressions (if specified)
RunIf expressions can also be specified when adding triggers. They are executed before the trigger is called, and the trigger is skipped unless the expression returns true. No error is thrown. This makes it possible to fire triggers conditionally.
If the trigger refers to an Entity which has a runIf expression then this expression is only executed once the trigger is invoked, and therefore uses the context of the trigger rather than the Entity which triggered it.
RunIf expression scripts use a language syntax called JeXL.
Documentation on the syntax can be found here: https://commons.apache.org/proper/commons-jexl/
Examples of runIfExpressions:
- _dim.country='US'
- _members != null
- _in.data.someAttribute > 5 && _me.email != null
Updated about 1 month ago