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.
$<scope>.functions.someFunction();
$functions.someFunction();
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);
<artifact-scope>.modules.<module-id>.<function-name>
. For example: $application.modules.calculator.add
For more about using global functions in extensions, see Add Global Functions.
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.