JavaScript Function Action Type
The Execute a JavaScript Function action type runs one of your saved JavaScript functions whenever the action is triggered. The function runs in a secure, isolated environment, and its result can be stored in a process field or used to complete a task.
Your functions are created and managed under Administration > Integrations > Code / Functions. Each function can define its own parameters, and those parameters become inputs on the automated action.
To set up a JavaScript Function action:
-
On the desired template, click the Automated Actions icon in the template designer menu
-
Give the action a name and select Execute a JavaScript Function as your Action Type
-
Select a trigger and add any conditions
-
In Action setup, complete the settings below
JavaScript Function settings
Section titled “JavaScript Function settings”-
JavaScript Function - Select the JavaScript function to execute
-
Function parameters - Each parameter defined on the selected function appears as its own input. Use the Insert Field Token button to pass values from your process into the function. If you leave a parameter blank, the default value defined on the function is used
-
How to Determine Success? (Optional) - A semicolon-separated list of responses to be considered successful, or a formula that evaluates to true or false. If provided, any result not in the list (or a formula that evaluates to false) is considered a failure
-
Store Result in Field - Optionally select the process field in which to store the value the function returns
Completing a task with the function’s result
Section titled “Completing a task with the function’s result”Use the Complete Task step to have the action complete a process task once the function finishes:
-
If the function’s result exactly matches the name of one of the task’s responses, that response is selected - this lets your code drive the decision tree directly
-
Otherwise, the How to Determine Success? setting decides whether the task is completed with the success response or the failure response