Function calling another function

This lesson describes how a function can call another function

Code: /lessons/Function_Calling_Another_Function

In this example, the function code accepts tableName, id, and records as input parameters. It gives an example of calling a function synchronously and asynchronously. The function queries records from DS synchronously and saves bulk records asynchronously.

Prerequisite

  1. In this lesson, it is assumed that functions- FunctionToCall.queryRecordsFromDSById() and FunctionToCall.saveManyRecordsInDs() already exist.

  2. It is assumed Customer class exits.

Steps

  1. Create a new function called FunctionCallingAnotherFunction.java and FunctionToCall.java.

  2. Set parameters in its function details file.

  3. Call FunctionToCall.queryRecordsFromDSById() function using FuncApi.executeFunctionWithMethod()(synchonously).

  4. It returns the response from the query.

  5. Call FunctionToCall.saveManyRecordsInDs() function using FuncApi.createTaskBySourceUid2() to save bulk records.

  6. Return the Result object (if there is failure) else return the response document.

Last updated