executeFunction()
Last updated 6/06/2023
Example
The following code calls the RequestBookServer function via
executeFunction()
to execute in the backend, the results of the execution will be sent to the RequestBook frontend function.
Calling a backend function via executeFunction()
function RequestBook(five: Five, context: any, result: FiveError) : FiveError {
const variables: any = {};
variables['UserKey'] = five.field.UserKey;
variables['Title'] = five.field.Title;
const _five = five;
five.executeFunction('RequestBookServer', variables, null, '', '', function (result) {
if (result.serverResponse.errorCode === 'ErrErrorOk') {
return;
}
const functionMessage: string = result.serverResponse.results;
if (functionMessage !== '') {
_five.showMessage(functionMessage);
}
});
return five.success(result);
}
Calling a backend function via executeFunction()
function RequestBook(five, context, result) {
const variables = {};
variables['UserKey'] = five.field.UserKey;
variables['Title'] = five.field.Title;
const _five = five;
five.executeFunction('RequestBookServer', variables, null, '', '', function (result) {
if (result.serverResponse.errorCode === 'ErrErrorOk') {
return;
}
const functionMessage = result.serverResponse.results;
if (functionMessage !== '') {
_five.message(functionMessage);
}
});
return five.success(result);
}