Having trouble getting GAS to execute functions in the order I need. In this code:
function documentUpload(e) {
var app = UiApp.getActiveApplication();
app.getElementById('documentValue').setText('Uploaded');
app.getElementById('documentValueLabel').setStyleAttribute('color', 'black');
checkSubmit(e);
return app;
}
...it always runs checkSubmit before changing the text. Which is useless because one of the things that checkSubmit checks is whether documentValue has text.
I saw this post and tried adding LockService like so:
function documentUpload(e) {
var app = UiApp.getActiveApplication();
app.getElementById('documentValue').setText('Uploaded');
app.getElementById('documentValueLabel').setStyleAttribute('color', 'black');
var lock = LockService.getPrivateLock();
lock.waitLock(10000);
checkSubmit(e);
lock.releaseLock();
return app;
}
...but I'm not getting any different results. Same thing for Utilities.sleep().
Thanks in advance for any suggestions!