Workflow not sending email

We are working with Version 7.10.11 (recently updated)

I have created some workflows previously which generate an email to a user when a new lead (which meets certain criteria) is saved, and those workflows work correctly.

A week later, I duplicated one of these, changed the criteria and user, and am unable to get the workflow to send the email.

I have tried creating the workflow from scratch, changed the criteria, used a pre-existing email template, created a new email, but am still unable to get an email sent when I load a new lead that satisfies the criteria. Screen dumps of the workflow and email are attached

(we have re-named the Leads module to ‘Buyers’.

Any suggestions or advice would be highly appreciated

Have you tried to send an email to a manually added email? not an user. Btw, does that user has a valid email?

best regards

1 Like

I have tried different combinations in the Workflow, and can get it to work when ‘Run On:’ is set to ‘All Records’. The workflow will not work when the ‘Run On:’ is set to either ‘New Records’ or ‘Modified Records’

Is it possible that a different workflow ‘executes’ first (just after ‘Save’ but before the above workflow executes, and that the system then does not recognize the current Lead record as ‘New’ or ‘Modified’ ?

If so, is there some way to set the sequence for workflows that run on the same trigger (e.g. on saving a new record)?

Thank you for your response

Yes, I have checked the validity of the email address as well as sent it to an email address entered directly (not to a User), with the same result. It looks like the conditions for the workflow to ‘execute’ are not met

can you check without any condition? just to test if it fires when is New Record

best regards

I have left the condition out, and it still fires only on ‘All Records’. Not for ‘New Records’ or ‘Modified Records’

if it fires an all records and not on new records I think it if because the scheduler is not working, because at the moment is firing when you’re saving the record, not on the scheduler by cron, when it checks if it’s new or not

check your cron

best regards

1 Like

Thank you again for you quick response.

I have cone to the Scheduler, and copied the following two ‘commands’ into the cron job on the cpanel:

To Setup Crontab
In order to run SuiteCRM Schedulers, edit your web server user’s crontab file with this command:
sudo crontab -e -u prote**7
… and add the following line to the crontab file:

          • cd /home/prote**7/public_html; php -f cron.php > /dev/null 2>&1
            

I have then run a ‘Repair’ in SuiteCRM, an ond re-run the workflows - still unfortunately only get the email sent on ‘All Records’ and not “New Records” or ‘Modified Records’

Could you possibly direct me to a way to test the cron?

Unless I am confused, if it fires on “all records” but not “new” or “modified”, then it is the opposite problem: the workflows launched from Scheduler are working, it’s the other ones that are failing.

I would look for issues with other Workflows (disable them) that could be hanging this.

Then check if you have any logic hooks (especially related to save events) that could be blocking execution.

Try some Repairs from Admin / Repairs.

1 Like

Thank you for that. I have made all other workflows ‘inactive’ and run a repair, and still get the same results. I am not familiar with logic hooks, so do not think that I have utilised any.

It is strange that when I make one of the other workflows ‘active’ the emails are sent correctly (with ‘Run On:’ set to ‘New Records’, but duplicating them does not allow me to duplicate the same results in a new workflow?

When you enter the Workflow module, an option appears on the left sidebar menu, called “View Process Audit”. Sometimes you find a hung job there, and it confuses Workflows. And there might be other clues by looking at that data.

Finally, consider also if you might have a “Repeated runs” misconfiguration. If this is not checked, and the Workflow has already run for a given record, it won’t run again (by design).

Thank you for all the assistance and replies.

I eventually figured out (after finding a post from John-EZS #55318) that some of the ‘Alert email’ Workflows were firing before my ‘Name Stamp’ Workflow, and some were firing after. Those that fire after, no longer consider the new Lead record as ‘New’, because it has been changed by the ‘Name Stamp’ Workflow.

According to John-EZS, the sequence of Workflow ‘firing’ is determined by the Workflow ID, and that is exacly what is happening in our case too

Ok. If it helps to know this, SuiteCRM ids can be anything, they don’t have to follow that format like “8602ef08-daf1-ba8c-7e77-58ee0bc96451”.

So I guess you could change it to “zzzzzzzz-daf1-ba8c-7e77-58ee0bc96451” to make sure it runs last. But be careful approaching any changes in the DB; you need to think if this id is used in any related tables,that relationship will break. This might, or might not be a problem, it’s up to you to evaluate.

https://schema–suitedocs.netlify.com/schema/tables/aow_workflow.html

Workflow ids are used as relationship keys in these tables:

aow_actions
aow_conditions
aow_processed
aow_workflow_audit
securitygroups_records

You should be ok if you just create a new empty workflow, then edit it’s id, and only afterwards you add conditions and actions, and start running it.