Home > Back-end >  Delete disabled triggers from Google Apps Script
Delete disabled triggers from Google Apps Script

Time:12-07

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.

CodePudding user response:

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.
  • Related