How to stop orphan triggers

An interesting use case:
1. Script 1 using the ScriptApp trigger control linked as an image link on Google
2. Created a new instance of Script under a new account and updated the link to the image
3. Removed the Script 1 container on Google

4. A user visited a Google site to invoke a script, but the page was cached, pointing to the previous Script 1.
5. E-mail error emails are sent to me by e-mail every time the β€œremote” Script is launched.

How to remove or stop these triggers?

0
source share
3 answers

If you know the user who installed the trigger, you can ask them to do with the "All my triggers" menu item in the script editor, find the trigger and delete it.

+1
source

The error email has a link for managing triggers. Make sure the triggers really disappear. I had this problem with a set of shared spreadsheets where I thought I deleted all the triggers, but my partner was still on.

0
source

In the Script editor, you can also programmatically launch project triggers, and then work with this trigger and source:

// Get triggers var triggers = ScriptApp.getProjectTriggers(); // Loop through each trigger triggers.forEach(function(trigger) { // Get the id var id = trigger.getTriggerSourceId(); // You can then use that id to get the related form or a sheet. Eg : var ss = SpreadSheetApp.openById(id); // You can also work with the trigger (ie delete it) ScriptApp.deleteTrigger(trigger); }); 

See https://developers.google.com/apps-script/reference/script/script-app for details

0
source

All Articles