2

I know it is possible to create a trigger:

function testTriggers()
{
  var now = new Date();
  now.setMinutes(now.getMinutes() + 1);

  ScriptApp.newTrigger("bingo").timeBased().at(now).create();
}

And once the trigger runs, it will be marked as Disabled.

enter image description here

I know you can get all triggers:

ScriptApp.getProjectTriggers()

But I can't find a way to identify which triggers are disabled so I can delete just those triggers.

I need to find the disabled triggers so I can then create more triggers.

IMTheNachoMan
  • 5,343
  • 5
  • 40
  • 89
  • Does [this](https://stackoverflow.com/questions/61383100) answer your question? – TheMaster Dec 03 '21 at 19:30
  • Does this answer your question? [programmatically disable / enable Google Apps Script script trigger](https://stackoverflow.com/questions/40974038/programmatically-disable-enable-google-apps-script-script-trigger) – SputnikDrunk2 Dec 03 '21 at 20:02
  • @IrvinJayG. No. Mine is asking about deleting a trigger once the google back-end disables it after execution. – IMTheNachoMan Dec 04 '21 at 02:01
  • @TheMaster Not really. I don't want to delete the trigger when it runs. I want to delete through some ad-hoc process. But there doesn't seem to be a mechanism to find disabled triggers. – IMTheNachoMan Dec 04 '21 at 02:02
  • @IMTheNachoMan You're right. I don't think there is such a mechanism. My answer is probably the closest you're looking for. Another workaround is to store the trigger id when trigger is created in props. And delete all triggers associated with a id in props later on. – TheMaster Dec 04 '21 at 08:08
  • 1
    Sounds like you've already figured out that what you want does not exist so why not go make it a feature request and move on. – Cooper Dec 04 '21 at 14:53
  • @Cooper I mean, I will but I posted this to first confirm I am not missing something. Could you imagine how messy it would be if everyone just posted a feature request for something just cause **they can't find a way to do it**? I'm not sure what problem you have with me asking.... – IMTheNachoMan Dec 05 '21 at 05:12
  • @TheMaster Thanks! If you want to answer this question with then then I can accept it. – IMTheNachoMan Dec 05 '21 at 05:12
  • https://issuetracker.google.com/issues/208980827 If anyone wants to help me out by upvoting it. :) – IMTheNachoMan Dec 05 '21 at 05:18

1 Answers1

1

Currently, there isn't a way to identify disabled triggers. This feature is requested by OP:

Kindly add a star to the issue, if you want Google developers to implement this request.

Possible workarounds:

  • Delete the trigger when the function is triggered
  • Save the trigger id as a key in properties, when the trigger is created. When the trigger function is triggered, add a disabled marker as value to the triggerid key in properties. Then you may deleted all disabled triggers later.
  • Manually delete all disabled triggers from the dashboard.
TheMaster
  • 45,448
  • 6
  • 62
  • 85