I have a published service on my script, the link to which I pass out to an email. Once the active account invokes the service a UiApp opens up for further processing. I do that using doGet(). Once the processing on the UiApp is complete I have a Submit button, linked to a server click handler, which is supposed to process the changes made through the UiApp forms. While I am able to change the values on the spreadsheet that I wish to change using this UiApp, I still have two issues which I encounter on clicking the Submit button:
- The Ui App doesn't close on pressing the submit button
- I am not able to call a browser msgBox to give a process complete verification message.
I have read a lot that on closing and returning the app the UiApp is supposed to get closed, but it isn't happening and I am assuming this is because that happens only if there is no serverClickHandler involved. I could be wrong.
Can someone help me with resolving Issue 1 and getting around Issue 2? A relevant version of my doGet and clickHandler functions are attached below.
function doGet(e) //On invoking service in the mail.
{
//Adding all other elements of the UiApp here
/* …
… All other elements of the UiApp
…
*/
//Adding Submit button to the UiApp
var button = app.createButton('Submit');
var handler = app.createServerClickHandler('click').addCallbackElement(panel);
button.addClickHandler(handler);
panel.add(button);
app.add(panel);
return app;
}
function click(eventInfo) {
var app = UiApp.getActiveApplication();
//Processing the actions that have to be performed on hitting the submit button
/* …
… Processing the actions that have to be performed on hitting the submit button
…
*/
app.close();
return app;
}