Date field doesn't work on report or workflow condition

Dears,

I’m facing a serious problem with dates ( custom or crm field) in reports and workflow coditions.
Mainly when I have a condition using operator like:
Date field + Operator=equal to + Type=Date+Value=Date field + 1 Day

Thanks in advance

Noberto

Hi Noberto,

What are you trying to achieve with your Condition?
Also, Could you provide a screenshot of your current condition, just to get a clear look at it?

Good Morning John,

I’m trying to create the following workflow

  1. To send a email with “welcome new client”.
  2. The condition is: I created a custom date that is filled with a date that the new client signed the contract.
  3. this welcome email will be sent after 2 days of signed date.

The idea is to create a after sales process. So I will send 04 automatic email from workflow as follow using the same custom date ( contract signed date):

  1. First email: welcome new client email after 2 days of contract signed date.
  2. Second email: asking if new client needs help or tecnical support after 30 days of contract signed date.
  3. Third email: asking again if new client needs help or tecnical support after 60 days of contract signed date.
  4. Last email: sending a survey about his new experience with us after 90 days of contract signed date.

I have tested workflow using condition with another type of data ( created user, comapny name ) and it works.
But if I add a codition using data type = date it isn’t work.

Thanks in advance.

Noberto Kicuti

1 Like

Hi,

The “Equal To” Operator is more for Exact values, such as matching two text fields together.
‘Less than or Equal to’ & ‘Greater than or Equal to’ are better for Date/time conditions.
You could try something like this:

Signed Date > Less than or Equal to > Date > Now -2 Days

However, Do note that this may fire on all records that have a Signed Date further back than 2 Days ago.

1 Like

Hey John,

I configured my workflow using your suggestion (less than or equal to) but with operator (now - 10 minutes) In order to test faster anf get the result.
So, in Signed date field (dateand hour type) I filled today date and hour ans minutes, but unfortunatelly it didn’t work.
In adition I filled in execution=Only In The Scheduler and Process=Modified Records.

A question: is there relation between workflow process and “audit checkbox option” in custom field property?

“Only in the Scheduler” and “Modified Records” may not be a good combination.
This would mean the Workflow would only fire if a Record is Modified at the same time as the Scheduler runs AND meets both conditions of the Workflow.
Unless this is what you want, it may be worth changing one of them.

Are your schedulers set up? If you go to Admin > Scheduler and click on “Process Workflow Tasks”.
Could you take a screenshot of this screen?

To answer your question, The Audit checkbox will allow you to choose whether or not you can view changes to this field in the Change log of a record. It shouldn’t affect workflow.


Hey John,
Yes , the scheduler is activated. See the screenshot.
I’m trying to create a workflow process to send 4 emails to the new customer :

  1. First email: welcome new client email after 2 days of contract signed date.
  2. Second email: asking if new client needs help or tecnical support after 30 days of contract signed date.
  3. Third email: asking again if new client needs help or tecnical support after 60 days of contract signed date.
  4. Last email: sending a survey about his new experience with us after 90 days of contract signed date.

So, the better combination could be “Always” and “Modified records” ? The workflow will be always executed when the records are modified.
Is it right?

Hi,

Since there has Never been a “Last successful Run” or any Job Logs, it seems your Scheduled Tasks aren’t set up at all.

You can find a line at the bottom of the “Schedulers” Page with the words “To set up Crontab” above it. I have attached what line I mean.
Your line will be different, but you should Insert that line into your crontab file to allow scheduled tasks to run.

Also, You will most likely need to create 4 separate Workflows. One for each Email you wish to send, since the conditions are so far apart.

Correct, “Always” and “Modified records” would mean the Workflow will always fire when a Record is modified. However, you will need to check the “Repeated Runs” checkbox on the Workflow itself. If this Checkbox is not checked, a Workflow cannot fire on a record more than the first time, so you wont be able to send 4 emails, only 1.

Hey John,

I’m going to check if this line was added exactly as was wirtten in “To set up Crontab” into crontab. BTW, do you know what line we have to add this line?

So, I just run the workflow and it was run with status=complete. But If I see scheduler process “Process Workflow Tasks” the line “Last Successful Run” continues with status = Never. Please see below.
You are right: I have created 4 workflows one for each email.

Hi Noberto,

I will attach an image of an example crontab file, to give you an idea of where to place it. Simply place it near the bottom of the file, on its own line.

Also, A workflow can run due to a few reasons. Such as Creating a New Record and Saving a Record. Doing either of these will run the Workflows, but only at that exact moment. So if you recently created/saved a record, this would explain why the workflow has “Complete” underneath it.

However, if you want the Workflow to check the records and run by itself every few minutes, this is why you’d set up the Schedulers.
The scheduler shows “Never” as it has not been set up to do Automated tasks yet, so has not run.

Hey John,

Thanks for your explanation.

I have a doubt:
We just upgraded to SuiteCRM Version 7.3.1 - Sugar Version 6.5.20 (Build 1001).
In your printscreen the crontab line referes to SuiteCRM 7.3.1. however in our Suitecrm Scheduler screen appears the following line:

          • cd /var/www/crm-unodata/suitecrm-7.2.2-max; php -f cron.php > /dev/null 2>&1 
            

The line is setting to suitecrm-7.2.2.
Is it correct? or is better replace suitecrm-7.2.2 to suitecrm-7.3.1 ?

Thanks in advance

Hi,

The crontab line normally points to the location of the instance itself, so if your instance was located at /var/www/SUITE-TEST/
The crontab line may look like * * * * * cd /var/www/SUITE-TEST; php -f cron.php > /dev/null 2>&1

This could mean that the instance itself may have been upgraded to 7.3.1, but if URL of the CRM is /var/www/suitecrm-7.2.2-max
then, the crontab line will show * * * * * cd /var/www/suitecrm-7.2.2-max; php -f cron.php > /dev/null 2>&1

So you may wish to ensure that the part after ‘cd’ in the crontab line is the correct URL of the instance. Usually the line found at the bottom of the Schedulers page is the correct one to use.

Hopefully, this explanation helps.

Hi John,
Your tips were really productive.
Currently workflows and scheduled reports are working.
Thank a lot !

Hi John,
It’s me again with probably the last question.

As you said,

The “Equal To” Operator is more for Exact values, such as matching two text fields together.
‘Less than or Equal to’ & ‘Greater than or Equal to’ are better for Date/time conditions.
You could try something like this: Signed Date > Less than or Equal to > Date > Now -2 Days
However, Do note that this may fire on all records that have a Signed Date further back than 2 Days ago.

So, how can I solve the problem this problem below:
However, Do note that this may fire on all records that have a Signed Date further back than 2 Days ago

Is there another way to schedule just records that were signed on specific day ?

I had a bad experience to send emails not only for correct clients but also clients that had “signed date” less than 2 days ago.

Thanks a lot again.

Best regards

Noberto

Hi,

You can set the workflow to fire on records that were signed on/after/before specific dates. Instead of: ‘> Date > Now -2 Days
you can do: ‘> Value > (choose a date)

However, you can’t choose specific days of a week, i.e: If signed date was a Friday.

Another way to restrict the workflow so it doesn’t fire on EVERY record that was signed more than 2 days ago could be to use the conditions:

Signed Date > Less than or Equal to > Date > Now -2 Days
Signed Date > Greater than or Equal to > Date > Now -3 Days

This should ensure that the workflow only fires if the Signed date is roughly 2 or 3 days ago, instead of 2+ days ago.

hi
i hve a similar problem. the line shown in my instance to set the cronJob is

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

          • cd /home/nettechs/public_html/suitecrm; php -f cron.php > /dev/null 2>&1 
            

This is done in my webserver - butstill the schedulers are not running.

my instance is on www.nettechsms.in/suitecrm

what should be my crontab line