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.
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.
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:
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.