0
votes

My app is invoked from google site.

Link on site is public. User clicks link to run public script.

Public script doGet() creates a fresh spreadsheet and stuffs it full of formulas. Also creates an onEdit trigger so when user makes changes to spreadsheet, some other project library functions run and give answers back to user spreadsheet.

User finishes work, or quits, or gets disconnected. Whatever, user has killed browser that was running the site (container page) and the spreadsheet.

OK the triggers don't show up in my (owner) project's list of triggers. So I am pretty sure -- and the google scripting guides seem to also say this -- that the triggers belong to the user's project space. Now the trigger is orphaned.

What's the program flow to be able to implement a user-created trigger and then delete it if the user quit?

I suppose I could ignore the orphaned trigger -- unless the user returns to the site daily and eventually has created too many triggers from the doGet().

So is it typical for google-apps to leave triggers orphaned and if you want to prevent too many triggers from frequent users, you look for old user-created triggers for that project in the doGet() before you re-create them?

Thanks!

1

1 Answers

0
votes

While you create triggers you could as well create a timer trigger that would kill himself and all its fellows triggers after a certain time... Not ideal and not tested but it should work.