SuiteCRM Version 7.11.3
Sugar Version 6.5.25 (Build 344)
Issue: Workflow is comparing Seconds with a Minute comparison, condition evaluates false.
Recreate: Add a custom DateTime Field to Accounts. Create a workflow condition that compares Now()-5 minutes
The SQL code snippet for the where clause is documented as accounts_cstm.date_field = now()-Interval 5 minute BUT now()-Interval 5 minute evaluates to HH:MM:SS. Forcing the custom field to HH:MM:00 still has no effect because at the time of the evaluation - now uses the clock seconds - virtually impossible to be true.
Apart from any possible bug, normally these time comparisons need to be made with < or >, not with =, precisely because of what you said, you can’t expect the comparison to be made at the exact time.
In normal expectations (without a code work around I did) the Process AOW Workflow Schedule runs every minute and I utilized this to run work flows. Basically, I added custom AOW Actions, and had workflows that I wanted to run at a specific time, on specific days. With out a date and time picker (more like an interval and / or frequency condition) in the workflow, we tried to set a number of “events” to happen in the future. Unfortunately, that means I am trying to add a condition that is equal to or greater than, equal to or greater than - in which these conditions run continuously.
The work around I found was to add an entry point that calls workflows. I then added a workflow with a new status called ‘Custom Active’. In this case, the processAOW_Workflow function doesn’t call my workflows (they need to be status ‘Active’). I then copied that function to a a copy that looks for the workflow ID as a parameter - and executes this from there.
This could be satisfied if the Conditions supported a HH:MM = HH:MM - and if I really had my wish - the conditions would support groupings and the OR clause.
If you have insight on what I may have interpreted incorrectly I would appreciate it - but in any case my hack seems to be effective for now.
To clarify my workflows execute a URL - in which I pass in querystring vars.
Maybe your approach is better, I don’t know, but the way I’ve seen this done before is
use a > or < for the time condition
have a separate mechanism to keep it from running more than once. This can be the built-in “no repeated runs” check, if it works well for your scenario, or a custom field that you set to “processed” once the Workflow runs
Maybe you can try solutions with that extra field and see they work better for you…
Thank you for the response - I did try and conditions where the date was greater than and less than by one minute. I think I remember that when you do greater / less than - the custom field is formatted with the sql statement DATE(custom date) and then you loose scope of MM:HH - so that won’t be granular enough. If I remember correctly the comparison equals goes to HH:MM:SS and the comparisons greater and less use DATE().
Probably an obscure requirement but a very helpful one for a ton of people I would guess.