Hi,
Is there a way to trigger a specific action on an entry? I've got a form with a number of email actions with conditional logic to send the email at specific times. I'd like to trigger the email to resend after a while if the user doesn't update the entry. I've looked at FrmFormActionsController::trigger_actions but that seems to trigger all actions. Does anybody know of a way to trigger only a specific email?
@Brian Penner - I've been asking myself this same question for a while and got sick of not having an answer. So I figured out one way to do it and made a tutorial out of it.
https://connect.formidableforms.com/user-tutorials/programmatically-triggering-specific-email/
Thanks Rob. That is exactly what I was looking for. I found some of those functions when I was checking the Formidable Code but didn't get it all pieced together.
The code is "not widely tested" to say the least 🙂
I trimmed this up a bit.
$entry_id = 21991; // somehow you have to set the entry id of the form entry you're dealing with
$target_action_id = 9897; // id of the action you want to fire off - you can get this from the database WP_POSTS with the post_type = 'frm_form_actions'
// or get it from the FF ui by opening the action and scrolling all the way down to the bottom right where it says "Action ID:
$entry = FrmEntry::getOne($entry_id, true);
$form_id = $entry->form_id;
$actionToDo = FrmFormAction::get_single_action_type($target_action_id, $type);
$form = FrmForm::getOne($form_id);
FrmNotification::trigger_email( $actionToDo, $entry, $form );
Nice! I'll update the tutorial.
Formidable's Form Action Automation add-on enables you to schedule emails. See this: https://formidableforms.com/knowledgebase/schedule-autoresponder/. The add-on schedules WordPress cron jobs, so execution depends upon when people visit your site, so the timing of the send is not an exact science, but close enough.
Please login or Register to submit your answer