JavaScript
The result can be used to determine which action will be executed next.
You can use functions, procedure calls, ANDs, ampersands, ORs, EQUALs, etc.
The Javascript workflow action evaluates and returns a true or false.
The result of a JavaScript action is either true or false. In other words, it needs to end with a boolean expression.
Here are a few possible evaluations to end your script with:
or
or
The following variables are available for the expression:
Here is how you can evaluate the content of a variable string:
parent_workflow.getVariable("NR_OF_ROWS") == 1000000;
Since we have access to the parent_workflow object, we can also set variables in the parent workflow this way:
For example you can do something like the following to manipulate variables within this workflow action:
useDate = parent_workflow.getVariable("use_date").equals("1");
if (useDate == 0) {
date = new java.util.Date();
dateFormat = new java.text.SimpleDateFormat("yyyyMMdd");
newDateStr = dateFormat.format(date);
parent_workflow.setVariable("start_date", newDateStr);
}
true;
When a workflow action finishes, the result of the execution will be a Result object exposed as “previous_result” to the JavaScript engine:
The “rows” variable we expose to JavaScript helps you evaluate the result rows you passed to the next workflow action using the “Copy rows to result” transform. Here is an example script on how to use this array: