Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can the function called by ScriptApp.newTrigger identify the triggerID?

In my app script web app I have multiple triggers created with ScriptApp.newTrigger()

example:

function createTimeTriggerSpecifcDate(dateStr) {
  const date = new Date(dateStr);
  const trigger = ScriptApp.newTrigger("scriptToRunAt")
   .timeBased()
   .at(date)
   .create();
  return trigger.getUniqueId();
}

function scriptToRunAt(){
 ....
}

Is there a way for the called function "scriptToRunAt()" to know the trigger id?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

thanks.

>Solution :

The event object provides the triggerUid:

function scriptToRunAt(eventObject){
 const uniqueId = eventObject.triggerUid;
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading