Search…
SDK and Frameworks
Use Rule Variables in Scripting Rules
This page contains an simple tutorial how to implement Rule Variables into your Scripting rule script.

Define Rule Variable

Rule Variables can be defined in Rule Settings section in scripting rule editor. All you need to do is to just simply define name and value of scripting variable.
Rule Variables editor
More detailed overview what you can do with Rule Variables is described here.

Use Rule Variables in Scripting Rules

Usage of Rule Variables in Scripting Rules is super easy. All RVs values are stored in theruleVariables object that is exposed in the script. You can use these stored values everywhere in the script (as inputs for your function or as inputs for DR.solve() function...)
Rule Variables supports JavaScript primitive data types only. (number, string, boolean, symbol)
1
const foo = ruleVariables.foo;
2
const bar = ruleVariables.bar;
3
4
output.Output = `Values of Rule Variables are: ${foo} and ${bar}`;
5
6
return output;
Copied!

What you cant do

You cannot set ruleVariables from script itself or overwrite existing Rule Variable.