Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

widgets.onGetById(getRecordById);

});


Flex Functions

Functions are similar to the methods bound to events. Flex functions are used to execute custom code by either hooks, or in our case, endpoints.

...

Custom flex functions must recive receive as parameters: (context, complete, modules).


Flex Logger

For logging purposes, Kinvey provides a logging module, which can be used inside handler functions of functions for custom endpoints. It provides different functionality for logging several levels: info(), warn(), error(), fatal().

We can access it using flex.logger.

function deleteOldItems(context, complete, modules){

const logger = flex.logger;

logger.info('Executing deleteOldItems Flex function');

// flex function implementation

}

Kinvey Create/Deploy Service

Test collection - kinvey console command

To deploy the Kinvey Camunda service, use the following command: kinvey flex deploy --runtime node12.

...

Once your service was deployed, you can check your collection from the API console, under Dashboard →Data (see Kinvey Collections screenshot below screenshot).

Here, you can test your collection/service with different requests: GET, POST, PUT, DELETE:

...

The only thing we need to specify is the methodType: "kinvey" in the request and the name of the custom endpoint in our, case "completeTask".


akioma.invokeServerTask({
       name: "completeTask", 
       methodType: "kinvey", 
       paramObj: { 
               id: "id-of-task"
       }
})

...