Execute a Function

A function can be executed by calling the execute() method in which the function ID and configuration (of type JSON) are passed as parameters. The functions reference used in the code snippets below is the component instance.

Create a Function Configuration (JSON)

Before executing a function, you must set the configuration required for it. Here, the configuration specifies the function arguments and their values. (function parameters)

The configuration can be set using the following code snippet:

    
copy
//Create Configuration for function Execution let conf = { args: { Name: 'Amelia' } }

Execute function

The unique function ID is passed as a parameter to the execute() function to call the function to be executed with the necessary configuration.

The promise returned here will be resolved to an object which is a JSON.

    
copy
let functions = app.functions(); //Call Function with the function ID and the configuration let promiseResult = functions.execute(1510000000059262, conf); promiseResult.then((functionResponse) => { console.log(functionResponse); });

Last Updated 2023-09-22 20:48:20 +0530 +0530