Call Function Action
The action module for this action is "vb/action/builtin/callModuleFunctionAction".
To call a module function, you need to pass the following parameters.
Parameter Name | Description |
---|---|
module | The module to call the function on. This could be "$page.functions" , "$application.functions" , or "$flow.functions" .
|
functionName | The name of the function to call. |
params | An array of parameters. Note that a single parameter must still be passed as a single item array. |
The outcome is either 'success' if the function call was successful, or 'error' otherwise. 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.
Suppose there is a function defined in the page functions module as follows:
PageModule.prototype.sum = function(one, two) { return one + two; }
You can call that function with the following action:
"myActionChain": { "root": "mySumAction", "actions": { "myAction": { "label": "call my sum function", "module": "vb/action/builtin/callModuleFunctionAction", "parameters": { "module": "{{$page.functions}}", "functionName": "sum", "params": ["3", "4"] } } } }
After this action call, $chain.results.mySumAction
should be set to
7.