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.

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)

const foo =;
const bar =;

output.Output = `Values of Rule Variables are: ${foo} and ${bar}`;

return output;

What you cant do

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

Last updated