I installed a form submit trigger for my project using ScriptApp around the beginning of May. The trigger has worked just fine however I now wish to uninstall the trigger and am running into problems. When I try to view all my current project triggers (Resources > Current project triggers), it returns that there are no associated triggers. Also when I try to run (Resources > All your triggers) it returns that there are no triggers shown.
I'd like to believe that this is the case, that the trigger in question has been somehow deleted but I don't believe that it is. To make sure the trigger didn't run, I de-authorized the script to run from my google account settings.
My suspicions that the trigger was not deleted were confirmed when I received a "Summary of failures for Google Apps Script: Form Processing Script" which told me my script had failed 3 times because, "Authorization is required to perform that action."
These failure e-mails also contain a statement, "To configure the triggers for this script, or change your setting for receiving future failure notifications, click here." When I click on the link, there are no triggers shown...
Here's a look at the code i used to install the trigger:
function formSubmitTriggerInstall() {
var formID = '1rOikLDUAqMWCB0ktjWzFE0oB6LmOHvXuzPAqyq0XLwE';
ScriptApp.newTrigger('processForm')
.forForm(formID)
.onFormSubmit()
.create();
}
I have also tried to locate the trigger using ScriptApp but to no avail.
Does anyone have any suggestions on how I can eliminate this trigger or get the associated trigger ID?
One other note, since I installed the trigger, the google developer's website and documentation went through a major face lift and some of the page content appears to be updated as well. Not sure that would affect my triggers though.
It was confirmed that this was a big and it was fixed by the apps script team.
Related
I have a published add-on on the Google Workspace Marketplace. Suddenly users have started getting the error
This add-on has created too many time-based triggers in this document
for this Google user account.
However, when I have the add-on log what triggers are installed, there are only three, and only one of them is time-based.
What I've started noticing, though, is in the master script file (the one I edit and then publish), when I look at triggers, there are a large number of triggers that are listed as being installed by "Other User." To be clear, there are no shared users on this spreadsheet or the script attached to it. Are these "Other User" triggers coming from users of the add-on?
Otherwise, I don't know what the above error would be referring to. But I also don't understand why the triggers for every user of the add-on would install in the master script.
I also went in and editing the code where the triggers are installed for each user to FIRST delete all instances of that trigger before installing it - same error.
I went a step further and made a button just to delete every single trigger - same error.
From the documentation:
Each add-on can only have one trigger of each type, per user, per document. For instance, in a given spreadsheet, a given user can only have one edit trigger, although the user could also have a form-submit trigger or a time-driven trigger in the same spreadsheet. A different user with access to the same spreadsheet could have their own separate set of triggers.
You may want to create any triggers you need in the onInstall(e) function so that they only get created once. That way, you do not need to delete and recreate the triggers every time the add-on runs.
I have a template google sheet that our company duplicates for every project.
The final result I want is to have an onEdit trigger that does a POST request. I actually already have this working. The issue stems from this: This trigger cannot be a simple trigger, it must be an installable trigger because according to Google's restrictions, simple triggers cannot make external requests, but installable triggers can. Again, all of that works, I just have to set up the installable trigger manually.
As I mentioned, this is a template document, so creating a new installable trigger manually every time it is duplicated is a real pain. I want to improve my UX by having it done automatically. Now the API documentation DOES detail how you can do this programmatically right here. So it definitely should be possible if I'm reading this correctly.
In order to have this trigger automatically created, I, of course, must use another trigger. In this case, it MUST be a simple trigger or we're back with the same issue.
So I added this onOpen() simple trigger function to my code: (convertAlias is the name of the function to run when the onEdit trigger activates)
function onOpen() {
if (ScriptApp.getProjectTriggers().length == 0) {
ScriptApp.newTrigger('convertAlias')
.forSpreadsheet(SpreadsheetApp.getActive().getSheetId())
.onEdit()
.create()
}
}
When I open the document though, I get no results. The stack logging shows the error as Exception: Action not allowed. The error specifically originates from the create() call.
I thought that maybe there was some issue with creating an installable trigger from a simple trigger so I went for the next best thing, a button. I added a button to my spreadsheet that was linked to the same code as a "generateTrigger()" function. Pushing that actually DID bring up the Authorization screen, which is what is expected. But then after authorizing my account, it then goes on to report the same Exception: Action not allowed. After that initial authorization, it does not ask me again and automatically goes to that error. I get the same results from running the function manually in the editor.
Is there any way I can make this installable trigger happen with any sort of automation? Is this an issue with my code, a permissions issue, or something else?
Thanks
It appears I should have just been passing the sheet and not the ID? Doesn't seem right but getting rid of getSheetId() made it work!
I'm having an issues with a "Sheets Addon" i am working on. I know how to create triggers in a normal script, but what I'm trying to do is create a trigger within an Addon that will call back to a function within that same addon. I want this to be a timed based trigger, every 1 or 2 hrs as the options.
If I create the trigger via sheets scripts, it all works fine, but using the same exact code for the addon.. it fails 100% of the time, but with no specific error, or at least not that i can get to easily.
I'm assuming there is something different to be add to the code to make a new trigger code work within an addon, but not sure what it is. any help would be greatly appreciated.
EDIT 12/4/2019::
example snippet... if i place this into the sheets script, and run it (from the sheet and not from the addon) it works fine. The trigger gets added and calls to the function with no issues. However when i run it from the sheet via the addon, the trigger still gets created but error our when processing.
function testCreateTrigger() {
ScriptApp.newTrigger('testRunTrigger')
.timeBased()
.everyHours(1)
.create();
}
One thing i'm noticing is that the Trigger for the sheet (non-addon) is created with Project name, Deployment, Event, Function ... all populated, but when i run it via the addon, the Deployment is blank.
Also installed the google salesforce addon which has a schedule feature which adds as a trigger, but that addon somehow creates the trigger with a "Blank" value for Project, Deployment, and Function ..but still knows what function within the addon/script to call to process. I think that's what I'm missing, how to create a trigger, from a function, within an addon.
I have been using a number of triggers based on form submission to a google sheet. Since yesterday the triggers have stopped working.
I have
unlinked and re-linked the form and sheet.
created a new response sheet.
recreated my scripts,
tried macros ( its a simple operation to sort the google sheet responses and send the top most response to another sheet )
the form submit trigger doesnt work. so to test I setup time based triggers. they seemed to work but stopped at 5 am this morning.
I can run the script manually and works fine but triggers do not run.
There was nothing in the logs. each trigger just stopped firing
Can anyone advise ?
Many thanks
I'd like to confirm the issue
Problem
installable trigger onFormSubmit from GoogleSheet stopped executing.
installable trigger onMinute from the same Spreadsheet still working and showing logs.
Logs are empty here:
https://script.google.com/home/projects/PROJECT/executions
Solution?
My attempts to resolve the issue:
Delete and create trigger again
Change the source code
Create 2 same triggers.
Possible other tests:
Create trigger from another account
Create a trigger with no code to test if it could execute at all.
Conclusion
In the end, one of my newly created triggers started the execution again.
I do not know what fixed the problem: changing the function text OR creating/deleting triggers OR some external fix on the Google side.
If some have more issues, please report the issue here:
https://issuetracker.google.com/savedsearches/566222
I have been implementing a spreadsheet for about a year and a half now that constantly runs a number of trigger based GAS functions to check data, send emails based on that data, and update a staff calendar.
All of the time driven triggers are executing normally. I have not had an issue with them. However, the spreadsheet driven triggers (onEdit, onChange) are not working at all. I left work for a two week vacation and I did not change the script at all. When I came back, it no longer worked.
I deleted the trigger, recreated it, and switched between onEdit and onChange; the trigger will still not fire. The function that is triggered on edit is dependent on the event for it to execute properly. I test ran the function outside of the trigger and it failed where I expected it to (where the event dependant variables are) so there was no surprise there.
As far as I can tell, the spreadsheet driven triggers just won't fire at all. Does anyone know of any issues on Google's end, are spreadsheet driven triggers working for any of you guys? As far as I can tell the trigger just stopped working all together.
If I explicitly nest my function inside the onEdit() function in the script, it will execute, it won't if I just create a trigger, however it throws an error saying that the script does not have the permissions to execute MailApp.sendEmail() even though the app is already authorized to send emails as me.
Even more interesting, the functions executed with time driven triggers are still able to send emails and update my calendar.
It seems like the spreadsheet driven triggers have quit working all together.
Just to be clear I did not make the mistake of naming my function onEdit or onChange.