Expression
π― Purpose
An Expression is used to filter clients participating in a campaign.
It is a script written in JavaScript or Python that evaluates a specific client's data and returns true or false.
Only clients for whom the result is true will be included in the campaign execution.
βοΈ Using the JavaScript/Python Engine
The timveroOS platform supports script execution in both JavaScript and Python via the ScriptManager component.
The CampaignExecutionService compiles the expression with:
Script script = scriptManager.compile(expression);And evaluates it for each client with:
Object evaluationResult = script.eval(Map.of("client", client));π‘ The script runs in a sandboxed environment with no access to unsafe resources.
Compilation or runtime errors are wrapped in a ScriptException and logged.
π Security
Scripts are executed with strict limitations:
Restricted classes
Execution timeouts
No external system access
Any error (e.g., NullPointerException, syntax error) is captured in an ExceptionEntity and shown in the UI as EXCEPTION_OCCURRED.
π§ͺ Expression Example
This expression selects clients who are:
Older than 25
Have an income over 3000
Live in the United Kingdom
π Code Usage Example
Last updated
Was this helpful?