Prevent Email Action, Conditionally

By: Michael Clark | Asked: 08/05/2022
ForumsCategory: How-toPrevent Email Action, Conditionally
Michael ClarkMichael Clark asked 2 years ago
I have an email action that triggers on update. I only want that action to run when only *one* field is updated, not when any other fields are updated.   Seems like it'd be a simple thing, and I can't for the life of me figure it out. How can this be achieved?
3 Answers
Best Answer
Walter JonesWalter Jones answered 2 years ago
Oh I see. Could you use Form Action Addon?  You could set the trigger to ignore sending after 1 minute from the update date?  

I guess that would work…although I haven’t tested it, it’s not a perfect solution, but it takes care of it assuming it works and they don’t update it again after 1 minute. 
Michael ClarkMichael Clark replied 2 years ago

Hi Walter. That's a good suggestion! I'm using the Form Action Automation add-on already, so it should've been a no-brainer. I'll give it a go. Seems like a decent fit, so unless the automation setting don't work, this is my solution going forward. I actually have quite a few singular actions in this project and two more in the pipeline. Helps if I just have a consistent set of things to dial in, versus burning hours reinventing the wheel.

Thanks again, for your insight. 🤓

Walter JonesWalter Jones answered 2 years ago
You should be able to set conditional logic on the email action. I guess the issue is that the update could consist of different data?
Michael ClarkMichael Clark replied 2 years ago

Hey, Walter. Yep. That's what I'm running into. I have the conditional on the email action to send if one filed is updated to a specific value. The trigger is set to when a record is updated. Trouble is, that value is permanently in the record and now, whenever any other field is updated, the conditions for the email action are met.

So I have to come up with a way to exclude that action from happening *after* it's one condition is met. It only need to fire that one time for each entry.

Any ideas on how to make that happen?

Chris AdamsChris Adams answered 2 years ago
Hi Michael, The frm_skip_form_action hook can be used to skip form actions. You might be able to amend one of the examples on that page to achieve what you need?  

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community