Passing Info from Function to Client Script
Hello,
I have recently started making use of client script for buttons, allowing me to give the user information or warnings before they proceed. This is great. However, I have never quite managed to pass back any extra information from the function to the client script.
As a simple example:
I have written a function which allows the user to copy files from "Deal A Workdrive Folder" to "Deal B Workdrive Folder". I would like to pass back the number of files copied so I can give a message such as "You have succesfully copied 3 files" in the client script.
How would I go about doing that?
The function stores the information in the variable name countUploads but I only seem to be able to return true or false to the client script.
In an attempt to get the info, I have returned the following at the end of the function but I don't know how to access it within the client script.
Function:
- if(countUploads > 0)
- {
- returnMsg = countUploads + " files of " + numOfFiles + " successfully copied.";
- }
- return returnMsg;
Client Script:
var response = ZDK.Apps.CRM.Functions.execute(functionName, { "orderId": removal_id, "newOrderId": record_id });
if (response) {
var sucessMessage = ZDK.Client.showAlert("success text", "Success Title", "Ok");
return true;
} else {
errorMessage = ZDK.Client.showMessage(errorText, { type: 'error' });
return errorMessage;
}