onEdit() script won't run when sheet is edited by Glide app

@Jeff_Hager wow, mystery solved for me too. I’ve been wondering why that onChange is triggering constantly. I do get errors from google pretty regularly, but it doesn’t seem to be affecting anything that I can see, so I just disregard them.

What kind of “if statement” could I write so that it only triggers for certain sheets? What would that look like exactly? I’d like to implement that if I can. My script is only relevant to a few sheets, so there’s no reason for it to trigger on changes to that App: Metadata sheet.

You can use the getSheetByName method, I suppose.

I already use that method. It’s part of the fuction itself, so comes after the onChange trigger. How would that affect when the onChange command is triggered? I do have lots of if statements within that function that only perform any actual work if a change has been made to a certain sheet. But I thought Jeff was talking about using an if statement to forgo the onChange command completely under certain conditions.

Oh I use the same method as you, which is to check if the event happens on which sheet and whether to continue or not based on that condition. So the script is actually triggered behind the scenes, but whether it leads to an outcome or not depends on the condition.

The COLUMNTOCHECK specifies column 2 (B). This is the column that contains the values altered by the choice component.

I get that bit, but you also said that there are 4 possible order statuses.

Where do you do actual check for the correct status before sending out the notification?

eg; IF COLUMNTOCHECK == “Being Prepared” or “Ready” THEN SEND_NOTIFICATION

possibly this line, trying to figure this line out?

if (message.match('complete') !== null)

Right. That’s the one…there are 4 statuses. If null…nothing. If complete…nothing. Which leaves the other two statuses.

Check out the script here. Here you can see that the script only continues if the active sheet is “Contacts”. It doesn’t mean that the script won’t run at all, but it will just skip over all of the code if the changed active sheet is not the we want to run code against.

Yes I get occasional errors from Google, but I only have a couple of user’s, so it’s not a big deal. The code that needs to run eventually runs anyway.