Need Script that sends email to backup email address on Automation Failure

Hey coding wizards. My company is using Airtable forms to manage customer orders inside of a club. When a new customer fills out a form, there is an “Email Address” field as well as a “Confirm Email Address” field. After the form is completed, an Automation sends an order confirmation email to the customer with the mailto: address being the “Email Address” field. But occasionally a customer will mistype their email address which will result in an Automation failure, requiring me to send the order confirmation manually. Since Airtable has yet to implement verification fields, I just use the backup email address and hope it’s correct.

I want a script that I can include into the automation that acts as an IF() statement. The logic being:

IF email automation results in a failure (aka the email address does not exist), then repeat the automation using “Confirm Email Address” field.

I feel like this could be a useful script for many service-driven workspaces in this community. If this is a simple integration I’d really appreciate any assistance since I don’t have coding experience. If not, if there’s anyone who can offer their services I’d be interested in learning more. Thanks!

Bumping this post. Anyone who can help me out?

To clarify again, I need a script that will re-run an automation to a backup email address field IF the original automation fails.

Is your current Automation using a Script action to send the email, or is it using the Email action?

Thanks for the reply!

My automation is using the built in Gmail “Send email” feature.

1 Like

Unfortunately, I’m not aware of any way to access the status of an Automation run from within a Script.

The only way I could see your desired workflow working is if the entire process was handled inside a Script action. There are ways to send emails from JavaScript – the best ones are likely paid solutions, but I think I’ve seen some free ones out there too.

This way you could have a single Script action that attempts to send the email, via JavaScript, to the first email address, and checks the server response; if it fails, then it sends the email to the second email address.

Here are some solutions to look into:



Thanks again for your response.

I can see here that there’s a Log that shows the status of automations. Could this be accessed using a script to show what has succeeded and what has failed?

https://support.airtable.com/hc/en-us/articles/360051858134-Managing-automations#:~:text=To%20access%20this%20information%2C%20you,details%20of%20the%20executed%20automation.

Thanks.

I’m not aware of any way to access that log from within a Script. I see nothing in the Script API documentation that would indicate an ability to access that Automation log metadata:

Bummer, that’d be an excellent feature to have as Airtable continues developing the Automations feature!

I think for a temporary solution I’m going to set up a formula that checks if the email fields are the same, if not, it will flag the record. Then if I get a notification that the automation has failed, I’ll have a button placed that on click will execute a different automation that sends to the backup email address. It requires a bit of manual work, but we’re not ready to host our own SMTP server just yet!

Makes sense.

FWIW, I fixed the link to emailjs.com (which got autocorrected in my first post), which I think can be used in conjunction with Gmail as your SMTP provider.

1 Like

I’ll definitely look into that then! thanks again for your help!