jkmayne
jkmayne

Reputation: 79

Is there a way to obtain details on triggers in Google Scripts?

Basically I am aiming to make an easier interface for managing time based triggers that control Google Scripts So far I have not found anything that would allow me to get details on the current triggers, specifically trigger times. There seem to only be a handful of methods supporting trigger management currently.

Documentation: Class Trigger

Thanks for any suggestions or pointers!

Upvotes: 1

Views: 130

Answers (2)

jkmayne
jkmayne

Reputation: 79

Per @Mogsdad 's suggestion I have submitted a feature request via the Issue Tracker . Please go and cast your vote for this issue and add any other suggestions for the request. The issue is fairly broad and there may be a lot of detailed information that could be useful if the right API is created. So please add comments in the issue tracker if there are parts you feel need to be addressed in an expansion of the current Trigger API.

Upvotes: 1

Mogsdad
Mogsdad

Reputation: 45720

The Apps Script documentation also contains Managing Triggers Programmatically, which is a very promising title.

However, this sums it up:

The only way to programmatically modify an existing trigger is to delete it and then create a new one.

Sometimes we find undocumented APIs by playing with auto-completion, but there don't seem to be any for Triggers at this time.

I tried this little gem, hoping to get logs full of trigger information:

var triggers = ScriptApp.getProjectTriggers();
for (var i in triggers) {
  Logger.log(Utilities.jsonStringify(triggers[i]));
}

All I got was "Trigger" repeated ad nauseum. So no help there, the Trigger object is locked down.

I'm surprised that there's no request in the Issue Tracker against the Triggers Component to add APIs to get this additional information, or to support more programmability. You should add one, and report it here so others can star it (cast their vote).

Upvotes: 1

Related Questions