Call Function
This action is used to call a function defined for the current flow, page, or application (web app). For extensions, it's used to call a function defined for the current flow, page, App UI, or extension. These functions are referred to as module functions, and they're created and edited using the JavaScript editor for a particular scope.
Using code, the syntax for specifying a module function that isn't a page function is:
$<scope>.functions.someFunction();
For page functions, the scope isn't specified:
$functions.someFunction();
Example
Suppose this function is defined for a page:
sum(num1, num2) {
return num1 + num2;};
};
You call the function and assign its result like this:
const sumResult = $functions.sum($variables.firstNum_pv, $variables.secondNum_pv);
Return Values
The result payload is equivalent to whatever the function returns (which may be undefined if there is no return). If the function returns a promise, the result payload will be whatever is resolved in the promise.