Elad Benda
Elad Benda

Reputation: 36672

newTrigger AppsScript doesn't appear in the UI

I ran this apps-script code:

 ScriptApp.newTrigger("foo")
      .timeBased()
      .everyMinutes(36)
      .create();

But I see no change in the triggers UI:

enter image description here

Upvotes: 1

Views: 172

Answers (1)

Marios
Marios

Reputation: 27390

everyMinutes(n): n must be 1, 5, 10, 15 or 30

As it is stated in the offical documentation, everyMinutes(n):

Specifies to run the trigger every n minutes. n must be 1, 5, 10, 15 or 30.

You chose 36 which is not supported.

For example, this works:

function foo() {
  // code here to be executed every 30 minutes
}

function createTrigger(){
   ScriptApp.newTrigger("foo").timeBased().everyMinutes(30).create();
}

Make sure you execute once the createTrigger function in order to create the trigger for the foo function:

enter image description here

Check also the error message. To my surprise, the error message is quite descriptive:

Exception: The value you passed to everyMinutes was invalid. It must be one of 1, 5, 10, 15 or 30.

Upvotes: 3

Related Questions