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
In this lesson, it is assumed that functions- FunctionToCall.queryRecordsFromDSById() and FunctionToCall.saveManyRecordsInDs() already exist.
It is assumed Customer class exits.
Steps
Create a new function called FunctionCallingAnotherFunction.java and FunctionToCall.java.
Set parameters in its function details file.
Call FunctionToCall.queryRecordsFromDSById() function using FuncApi.executeFunctionWithMethod()(synchonously).
It returns the response from the query.
Call FunctionToCall.saveManyRecordsInDs() function using FuncApi.createTaskBySourceUid2() to save bulk records.
Return the Result object (if there is failure) else return the response document.
Last updated