Script examples - used on navigation arrows
It is only if you use nodes of the type Gateway that you can add scripts to the navigation arrows. Scripts are written in the programming language javascript. In Flow, an operator is used in logical statements to determine equality or difference between variables or values. Operator can be, for example:
== (is equal to)
!= (is not equal)
> (greater than)
< (less than)
<= (less than or equal to)
>= (greater than or equal to)
&& (and)
|| (or)
To add a script to a navigation arrow, click the arrow and then Condition. The following script is included by default:
function fn(node){
return true;
}
Use a value from the dialogue to determine the way forward for the next task

==function fn(node){
return node.should_have_access == "Yes" ;
}
where should_have_access e.g. is the variable name of a radio button list in dialogue, and Yes is one of the choices in the list. Please note that the spelling must be exactly the same, a small letter instead of a capital letter is enough to stop the flow. The radio button list must also have a label for this to work.
You can find the correct ID for the fields in the dialogue by typing node. followed by the first letters of the label of the items you are looking for, e.g. node.sha to find the field shall_have_access.

==function fn(node){
return node.Is_applicant_and_wi == "No" || node.Is_contact_person_and_event == "No";
} In the example, selections from two different places in the dialogue are used to determine whether the condition is met. "||" means or in this script.

With conditional scripts, there are often many paths to the goal. Imagine that you have a flow with an activity to the financial department that is only to be carried out if the leave application results in a deduction in salary. We can check this, for example, on a radio button "Type of leave" with the selection options "With pay", "Without pay" and "Partly without pay". This can be solved as follows:
function fn(node){
if(node.Type_leave == "Without pay") {
return true;
else if (node.Type_leave == "Partially unpaid")
{return true};
else if (node.Type_leave == "With pay") {return false};
}
or like this:
function fn(node){
return (node.Type_leave != "With pay")
}
With both of these scripts, the "With salary" option will return false, while the other two will return true, and the result will in practice be the same.

The include() function enables you to use a checkbox list in a dialogue, where one or more of the choices activate the arrow that goes out from the node. If the dialogue user selects an option that activates the arrow going out from the node and one that does not, the flow will NOT fail. Here is an example of a condition where the selection must only include “Finance/acquisitions” to proceed:
This script, on the other hand, must include "Economics/acquisitions" OR "WebSak" to proceed:
Order assistance from a consultant if you need help with scripting.