Workflow send tasks email remind

Hi there everybody!

I am trying to create a workflow in order to send an email when in a task the value of a custom field (Remind date) is matched.
the workflow is configured as follow:

Base
Module: Tasks
Run: only in scheduler
Run on: All records

Condition 1
Module: Tasks
Field: Remind date (datetime custom field)
Operator: Equal to
Type: Date
Value: Today

Condition 1
Module: Tasks
Field: Remind date (datetime custom field)
Operator: Equal to
Type: Date
Value: Now

Actions
Action: New email
Emails: To Related Fields Users: Assigned To

But this seems not working. Does anybody has some suggestion?

Hi, welcome to the Community! :tada:

For date-based Workflows, always use greater than or lesser than to compare, not equal. Date fields are actually PHP Datetimes and the date may be stored internally as dd/mm/yy hh:mm and it will take a lot of luck to hit the exact value.

Hi pgr!

thank you for the quick reply!!

I have followed your suggestion and (obviously :slight_smile: ) the remind sending is working.

But now I have another slightly different issue:
Using the “lesser than” condition the system correctly send the alert but only once, I can’t postone the alarm (set another alarm to the same task in the future). I can undestand that this is due because I haven’t selected the “Repeated Runs” option but when selected it keeps sending the alert every minutes. Is there any workaround?

Thank you again for your support!

There is a way to work around that, but you’ll have to see if it isn’t too heavy in terms of performance: you’re using an All Records workflow, if there are many records they will all be scanned each minute… :scream:

You would need to use another field as an auxiliary. You can either create a new custom field for it, or just use another field already in the Tasks record, that you don’t need for anything else.

You would turn on Repeated Runs, and add a second condition, to only run if your auxiliary field is a certain value (false, or zero, for example). After sending the email, add an action setting your field as something different (true, or 1, or whatever), to mark the email notification as “done”.

Then to reset the process you just change the value back to whatever signals “not done” yet (false, or zero, or whatever).

Great! It works perfectly!!

In tearms of performance, would it be better not using the All Records and instead create two workflows one for New Records and one for Modified Records?

Thank you very much for your precious help

That would be equivalent, it wouldn’t help much.

The real difference is if you could make this “on save”, instead of “on scheduler”. Then it would only run for a single record, as it is being saved.

But once you have “on scheduler”, it’s going to start every minute, and it’s not running within the context of a single record, so it will basically loop through all of them. Preventing repeated runs would eventually bring the number of records down, but now that is not possible.

I don’t think this particular requirement can be handled any more efficiently from within workflows. My advice is just to leave it as it is, if you don’t run into performance problems. You might also want to adjust the Workflow job to run only every 2 or 3 minutes (the downside is less immediate meeting and assignment notifications, email updates etc).

If you really need to improve of this you’ll have to let go of workflows and make a custom PHP scheduler where you can SELECT only the records with the auxiliary field unset, so you start looping already focused on the records that interest you. And in the custom job you can easily set it to run much less often without any side-effects.

Thank you for your help pgr!

Really appreciate it

1 Like