Emails sent when using Event trigger with Workflow

Sorry if this is a dumb question but having gone through the docs and the forums I am still unsure.

I have just started using events and we are now assigning contacts to them (less than 10 per event). I now want to create a workflow that auto-emails these people 7 days before the event to remind them their event is coming up. My concern is the email will go to the thousands of people we have in the system and not just the 10 on the event that triggered the workflow. I have set it up with the following:

Conditions
Module Field Operator Type Value
Events Activity Status Equal To Value Active
Events Start Date Equal To Date Today + 7 Days

Actions
Select Action: Send Emails
Send Individual Emails: ticked
Email Template: my template
To Related Field Contacts:Contacts

My concern is the last bit. I am struggling to find real clarity on what exactly “To, Related Field, Contacts:Contacts” will include. I am hoping “related field” means the individual contact related to the event trigger (ie: signed up for the event), but I am a bit wary as I don’t want to potentially send thousands of emails by accident.

Any thoughts?

Thanks

A

It is very relevant to include also the initial option of the Workflow (On save, all users, etc)

As a testing strategy, you can make your workflow change something in the record, instead of sending the email. For example, it can write that Related Field, Contacts:Contacts field into another field (a new custom field, or an existing field that you don’t need). Then you can check what happened and get a preview of what will be sent.

I have that set to only in the scheduler and all records as sending it later in the day is fine.

Good idea about writing a new field, will give that a go, thanks.

I’m always very nervous with anything that can email the whole database, having learnt the hard way about 20 years ago. Traumatised for life :slight_smile:

Thanks for the pointers pgr.

Note that “on scheduler”, “all records” will go over every record in the DB every minute, if you have your cronjobs configured with that regularity (which is the usual setting).

I agree that one needs to be very careful to avoid accidental spammings. That’s the reason that led me to add Campaign Previews to my add-on PowerReplacer.

OK, tested this with writing to a record and it worked fine.

So I have now done the same again with the Action set to “Send Email” this time. Setting used are “Send individual emails” ticked, and “email template” set to one I created. The rest of the workflow is basically the same as last time.

Once the cron has run, I don’t receive any email.
If I view the workflow, Under Process Audit it says failed in the status column.

I have looked in the suitecrm log and see the following:

Wed Jul 14 13:10:03 2021 [1856552][-none-][FATAL] cron.php: can’t determine running user. No cron user checks will occur.
Wed Jul 14 13:15:02 2021 [1865589][-none-][FATAL] cron.php: can’t determine running user. No cron user checks will occur.

However, under Admin / Schedulers the Process Workflow Tasks is showing as having run.

Also if I go to the email setup page in admin I can send a test email fine and they come through no problem.

I am bemused what could be causing this. Within the email template I do use the following variables:

$fp_events_name
$fp_events_date_start
$contact_first_name
$contact_user_first_name
$contact_user_last_name
$contact_user_title
$contact_user_email1

Could these be causing a problem? Any thoughts?

By the way the PowerReplacer looks interesting, assuming I can get workflows to work of course.

Thanks

Andy

Just retested it with a template containing nothing but a few words of text, no variables at all, and it still isn’t working.

Maybe you can try an email with a fixed email address (sent from a Workflow) to see if it sends.

The email account that the Workflows use is defined in Admin / Outbound email settings / system account.

Got it working in the end and wanted to post in case anybody else encounters this.

The issue was my configuration in the Actions section. You select the action as “Send Email”, pick a template, and tick the send individual emails box, but that by itself doesn’t actually populate the “to” address. The fact that under Process Audit it says “Failed” causes even more confusion as it implies it has tried to send something.

In a nutshell it has, but to a blank “to” field because it hasn’t actually put an email address in there.

In order to get it to send, you still need to add an email address in the Actions box in the workflow by clicking the plus below the Email label, and setting it to “To” “Related Field” “Contacts:Contacts”. This then populates it with the email of the contacts that are registered as delegates for the event.

This final step is what I missed, and without it the to address isn’t populated and nothing gets sent.

I had assumed this was being filled in automatically, and whilst workflows are covered in the documentation it isn’t especially clear on this bit.

Thanks again to @pgr for help on this and steering me in the right directions.

Andy

1 Like