# Create task reminder with workflow 1 minute before duedate & duetime

• I would like to get an email notification 1 minute before de task is due. I don’t seem to get this what am I doing wrong? See attachement.

It works only when I put the date on today. Then I get notifications about all taks due for today at the same time. But this is not what I want.

• Furthermore I would like to put a link in the notification-mail, so people can immediately click the link and go to that task directly.

Really appreciate it if someone can help me with this!

Regards, Stephanie

Anyone can help me with this?

Have a look at the following post and read the examples I posted to understand the logic behind.
https://suitecrm.com/forum/suitecrm-7-0-discussion/5606-workflow-question-what-does-date-now-mean#20710

Basically you should have only one condition and it should be something like:

due date <= now + 1 minute
However this may not work perfectly depending on the interval at which yoiu have set your cron jobs: if the interval is more that 1 minute (for example 5 minutes), the workflow may fire up to 4 minutes after the moment you were expecting it to fire!

To make it easier to go straight to the point, this is the part I refer to in that post:

a. We have a field called Due_Date and it is set at an imaginary date 15
b. Today is day 0
c. We want to create a workflow to send a reminder 10 days before Due_Date
d. We want to create a workflow to send a message 3 days after Due_Date

For Workflow c. we set our condition: Due_Date <= now + 10 days
. Since today is 0 the condition will evaluate to Due_Date (=15) <= now (=0) + 10 (=10). This statement (15 <= 0+10) evaluates to false so the action is not activated
Tomorrow now will be equal to 1 so the condition will evaluate to 15<= 1+ 10 which is FALSE
The day after tomorrow now will be equal to 2 so the condition will evaluate to 15<= 2 + 10 which is FALSE
After one more day now will be equal to 3 so the condition will evaluate to 15<= 3 + 10 which is FALSE
After one more day now will be equal to 4 so the condition will evaluate to 15<= 4 + 10 which is FALSE
After one more day now will be equal to 5 so the condition will evaluate to 15<= 5 + 10 which is TRUE so our workflow will trigger the action!

For Workflow d. we set our condition: Due_Date <= now - 3 days
We start over from the beginning so today is back to 0 so the condition will evaluate to Due_Date (=15) <= now (=0) - 3 (=3). This statement (15 <= 0 - 3) evaluates to FALSE so the action is not activated
Tomorrow now will be equal to 1 so the condition will evaluate to 15 <= 1 - 3 (=-2) which is FALSE
The day after tomorrow now will be equal to 2 so the condition will evaluate to 15 <= 2 - 3 (=-1) which is FALSE
After one more day now will be equal to 3 so the condition will evaluate to 15<= 3 - 3 (=0) which is FALSE
After one more day now will be equal to 4 so the condition will evaluate to 15<= 4 - 3 (=1) which is FALSE
After one more day now will be equal to 5 so the condition will evaluate to 15<= 5 - 3 (=2) which is FALSE
After one more day now will be equal to 6 so the condition will evaluate to 15<= 6 - 3 (=3) which is FALSE
After one more day now will be equal to 7 so the condition will evaluate to 15<= 7 - 3 (=4) which is FALSE
After one more day now will be equal to 8 so the condition will evaluate to 15<= 8 - 3 (=5) which is FALSE
After one more day now will be equal to 9 so the condition will evaluate to 15<= 9 - 3 (=6) which is FALSE
After one more day now will be equal to 10 so the condition will evaluate to 15<= 10 - 3 (=7) which is FALSE
After one more day now will be equal to 11 so the condition will evaluate to 15<= 11 - 3 (=8 ) which is FALSE
After one more day now will be equal to 12 so the condition will evaluate to 15<= 12- 3 (=9) which is FALSE
After one more day now will be equal to 13 so the condition will evaluate to 15<= 13- 3 (=10) which is FALSE
After one more day now will be equal to 14 so the condition will evaluate to 15<= 14- 3 (=11) which is FALSE
After one more day now will be equal to 15 so the condition will evaluate to 15<= 15 - 3 (=12) which is FALSE (by the way this is the Due_Date but the workflow is not activated yet!)
After one more day now will be equal to 16 so the condition will evaluate to 15<= 16 - 3 (=13) which is FALSE
After one more day now will be equal to 17 so the condition will evaluate to 15<= 17 - 3 (=14) which is FALSE
After one more day now will be equal to 18 so the condition will evaluate to 15<= 18 - 3 (=15) which is TRUE so the worflow will trigger the action

Sorry for being so long but I hope you understood the logic of using Now and a due date.
Now obviously refers to the date in which the workflow is run. This happens everytime the cronjob runs the workflow task.

I hope this was useful to clarify your purpose.

Yes , I already saw that post but it didn’t help me. The cronjob is installed for every minute and as you can see I already set a condition like you said. When you look at my screenshot.

Do you maybe have teamviewer? Than you can see it.

Regards, Stephanie

Your conditions are not correct. you have minus (-) one minute while you should have plus (+) one minute.

You also have a second condition, which I assume is there because you don’t want to trigger the action on old items

TeamViewer: if necessary I can install the free version!

Yes I also have the free version! If you can do that then I would really appreciate it! How do we keep contact?

I did it now with +1 minute. But I already tried that many times I think.

Yes the second condition is because I don’t want to receive all notifications of the whole last year.

When I create a taks I immediately get a notification. That is not what I want. I want to receive the notification only 1 minute before the due-time.

I am not sure if the two conditions are evaluated with an OR, or an AND.

If it’s OR the Workflow will always fire. So, just for testing purposes, you could try removing the condition in which you test the fixed past date (Due Date > 16/12) I think that’s where the problem is!. However this will fire on all records that meet the 1 minute condition (all those for which the due date has already occurred) so you should send the message to a dummy email.

I understand what you are saying. When you try this workflow (1 minute before due-time) does it work with you?
I don’t know how to send it to a dummy email.
It will send all notifications then to all the users that are related to the record.

Thank you for helping!

I’ve tested too this feature withut success, even I messed arround with time zones if that was an issue, because remember that every time and date is stored in UTC and according to your time zone it shows differently.

If this is fixed, for your second question you just need to make an email template and add this line of code in the body of the email

``http://{yourdomain}/index.php?module=Tasks&action=DetailView&record=\$task_id``

where the variable \$task_id is the ID of the current task that you’re sending mail from, and that link is to open it.

regards

mikebeck

Hi Stephanie,

I did a test with only one condition and it works fine for me.

To test with a dummy email you may enter a specific email address in the action. In this way you can check at least if your workflow is triggered correctly.

If it works you have to update the workflow and put the correct email. However, when you do this, I am not sure waht will happen (will it send for only the new tasks or also for past tasks even though it has sent it to the dummy email address?)

Alternatively you could create a scheduler that runs continuously, but to do this you need to have programming knowledge (not very complicated though).

You can start having a look here:
https://github.com/audoxcl/SugarCRMSchedulers

If you need help let me know

Hi Karma,

Thank you so much for helping me and make time for it! I really appreciate it!
Can you make a screenshot how it looks like in your workflow? Then I know for sure how you put in the dummy mail.

I am going to try it now!

Have a nice evening!

Regards,
Stephanie

Have a look at this image.
Note that I set it to run only on new items

As you can see I did it like you said. But when creating a task at for example 23:19 I also get the e-mail notification immediately at 23:19.
Is it possible to do Teamviewer tomorrow maybe?

It probably is something very small but I don’t seem to find it.

Thank you for helping again.

Hi Stephanie,

today I have a hectic timetable but tomorrow should be OK. I’ll send you a message.

In the meantime can you check the type of field of “Expected Close Date”: is it Date or Datetime? maybe that is the problem. (in case I recommend that you create a new Datetime field for testing and then decide what to do later. (if you modify the type of field you will probably lose the values)

Hi Karma,

I checked both yesterday! Tomorrow is good.
Speak to you tomorrow then!!

Regards,

Stephanie

Hi Karma,

And do you maybe have time now to share teamviewer?

With the most respect,
Stephanie