Create Simple Scripting Rule
This tutorial will walk you through the creation of a simple Scripting Rule.
How to create a simple decision table
Let's advance one step at a time.
1. Log in
Becoming a superhero is a fairly straightforward process. After entering our login page, you will be able to pass your credentials and log in.

There are multiple options for user login. If you do not have an account yet, you can create one. After logging in to the application, the folder structure of your Rules List will be displayed.
2. Create a new Scripting Rule
To display the rules creation list, click the + Create button on the search bar. Select your rule and you will be prompted to provide a name. For this example, select a name for your rule as you wish and press "Confirm". The new rule will be created and its design interface will be displayed. We will continue in the Rule Setting menu.

3. Make basic settings
Rule Settings will be in a left-hand side menu, or you can access them by Rule Model at the top bar. Let's do some settings. Since we do not want this decision table to be available yet, we will change its status to Pending. To do this, switch on the current status Published to Pending.
To apply these changes, we have to click the Save button at the top of the page, right corner.
4. Create an Input and Output model
We will now create an input and output model, which we will then use to set conditions and results. We create this model with a JSON editor.
After creating an input or output model, we must always confirm the changes with the Save button.
Input model
First, we delete all created objects. Then we will add our specified requirements (value1, value2) as empty objects. Let's start with the input model. First, you can switch from "Designer" to "Model" at the centre of the top bar. Change from Simple Editor to JSON Editor at the toggle next to the "Rule Settings" button. Delete all default objects. Then add your specified requirements, e.g. value1, value2, as empty objects.
Because our model is simple, these objects do not contain any others. For more complex models, more information is here.
Input model Example:
Output model
We set the output model similarly, where we set it as root result (empty object).
Output model Example:
6. Creating rules
Now let's move on to code editor by clicking on Scripting Rule Designer it in the upper center and create individual rules.
Our code editor is based on Monaco Editor, using its features, like autocomplete, syntax highlight, line numbers, etc.
Shortcut Keys are also working, but you need to be with a cursor in the editor.
CTRL/CMD + S - save
CTRL/CMD + R - run
CTRL/CMD + Z - undo
CTRL/CMD + SHIFT + Z - redo
CTRL/CMD + F - find
SHIFT + ALT + F - format
Scripts must be written in JavaScript language.
For simplicity, we will remove the code from the code editor to create a new rule.
When to code editor is empty, we can start to create our own rule in JavaScript. It is straightforward, and you need to write your code which can look like below.
Input must always be entered as input.yourInputVariable.
Output must always be entered as output.yourOutputVariable.
To return an output, always enter return output at the end of your script!
console.log() is forbidden due to performance, but you can use log() instead.
You can use log() to print values in the console, which is at the bottom of the code editor.
Always save your script using Save (bottom of the page) or CTRL/CMD + S
7. Test created scripting rule
Don't forget to save your scripting rule!
Now we can test our rule. Before testing the rule, we must change the status of the rule to "Published".
If we want to test a rule, we can click on the Test Bench button. An input and output window will show up at the bottom of the page. Press the Run icon at the center of the window.

You can find more information about input and result at Solver API.
The result will be displayed in the Output window (the right one).
The debug mode can be turned on by clicking on Debug off . In scripting rules, it will enable to write log() in the console.
Request body example:
Response body example:
More information about Test Bench is here.
Last updated