I have a spreadsheet that calls functions in a standalone script through the onEdit trigger. The standalone function have loops and can to a few seconds to execute. If the user edits another row while the standalone script is running the information from the second row gets mixed up with the one from the first row in the loop.
code in standalone script is:-
var tasklistID="mytaslistid"
function getTasks() {
var tasks=Tasks.Tasks.list(tasklistID)
return tasks
}
Code in spreadsheet is:-
function getTasks(){
TaskManagerScript.getTasks()
}
Installed onEdit trigger calls the spreadsheet getTasks function which in turns calls the standalone getTasks function
NB: This it a simplified version of my code. The actual version also filters the task to extract tasks from a particular date. This involves looping through the tasks in the list which takes time
So I need a way to lock the spreadsheet from editing until the function in the standalone script have complete its execution.
Thanks
TaskManagerScriptis a library. Right? - TheMasterreturn trueor something from thegetTasks()function. You probably just need to changecallStandaloneFunction()in my answer togetTasks(). Installed onEdit() should run another function that just opens my modal dialog. My modal will callgetTasks()and will close after a successful return from thegetTasks()function. - TheMaster