I have come across a strange issue and hope someone may point me in the right direction, or move this post to the developer section if more appropriate.
I have a workflow that works on the Leads module. It is set to “Always” run on “Modified Records” with “repeated runs”.
It runs on every Workflow task invocation.
I changed the workflow to run “Only on Save”, on “Modified Records” with “repeated runs”. Now, when I edit the lead that should trigger the workflow, nothing happens; the system log shows
[ERROR] fromUser: Conversion of 2018-09-24 23:59:59 from user format d/m/Y H:i failed
[ERROR] fromUser: Conversion of 2018-10-24 03:23:16 from user format d/m/Y H:i failed
From a database lookup, these dates are the creation and modification date for the lead that is supposed to trigger (but doesn’t even enough to show a “fail” in the process audit).
I tried the simpler things, such as changing the user format (and system format) (using the user control panel), but this did not help.
A quick look at the code shows 3 uses of fromUser in modules/AOW_WorkFlow/AOW_WorkFlow.php and one in modules/AOW_WorkFlow/aow_utils.php, but I am not sufficiently familiar with DateTime and TimeDate classes to debug this.
Is this the likely source of problems?
I have replicated this in a number of environments, (php 5.6 and SuiteCRM 7.8.22 in TurnKey), (php 7.0 and SuiteCRM 7.8.16 in Ubuntu 16.04.4)
Unfortunately, that didn’t appear to be the problem. I was surprised to find that the timezone was correctly set in all the php.ini to the correct one (which for me is date.timezone = “Australia/Melbourne”).
I have created a custom AOW Action (although tested the issue with pre-existing modules as well, and against the online demo too)
I have created a lead, last name “Kirk”, and have a Workflow that performs a custom action when it matches condition
1 Leads Last Name Contains Value Kirk
I have 3 debug files, as follows:
1 – workflow being triggered correctly, from scheduler
1 – workflow not being triggered, from OnSave
1 – modified workflow (now searching for “irk”) triggered, from OnSave
Simplest way to find if workflow has triggered is to look for line that says
“[FATAL] Workflow called on object d0790f00-e986-06f1-b82c-5bd2e573c943 Jim Kirk” or just search for Kirk
This is the (log) output of this simple workflow.
Error logging was on, but there was no log file set-up. I enabled it (to both php_errors.log and syslog), killall -9 apache2, service apache2 start, and re-run the workflow; I could neither find php_errors.log ( find / |grep php_error.log) nor any entries in the syslog regarding php errors.
Meanwhile attached .txt is a diff between the 2 php.ini files. There are differences, but the memory things could be the only one; and that doesn’t explain why the substring “irk” is matched, while the string “Kirk” is not.
Just to clarify, is the expected behaviour of “Contains” supposed to match the full string or not?
service apache restart
find / -name php_errors.log 2>/dev/null
Sometimes when I want to make sure I find php_errors.log I add this line to the beginning (after the license text) of SuiteCRM’s index.php:
$myWarning = 3/0;
This is will make sure a “division by zero” is generated, when you see it in a log file, you know you have the correct log file.
Please search Google for generic solutions about the log file, when you get it working tell me if we have any further clues. This effort is well worth making - it is a critical element of troubleshooting SuiteCRM.
However, there are no entries when the workflow doesn’t get called, (other than the division by zero).
[27-Oct-2018 21:55:02 Australia/Melbourne] PHP Warning: Division by zero in /var/www/suitecrm/index.php on line 45
p.s. “service apache2 restart” is a bit slow to kill things, so that’s why i use killall if that matters.
p.s. 2 ====apache logs
[Sat Oct 27 21:53:13.368400 2018] [ssl:warn] [pid 20727] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Sat Oct 27 21:53:13.369098 2018] [ssl:warn] [pid 20727] AH01909: localhost:12322:0 server certificate does NOT include an ID which matches the server name
[Sat Oct 27 21:53:13.441103 2018] [ssl:warn] [pid 20728] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Sat Oct 27 21:53:13.441596 2018] [ssl:warn] [pid 20728] AH01909: localhost:12322:0 server certificate does NOT include an ID which matches the server name
[Sat Oct 27 21:53:13.441831 2018] [core:warn] [pid 20728] AH00098: pid file /var/run/apache2/apache2.pid overwritten – Unclean shutdown of previous Apache run?
[Sat Oct 27 21:53:13.445212 2018] [mpm_prefork:notice] [pid 20728] AH00163: Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured – resuming normal operations
[Sat Oct 27 21:53:13.445263 2018] [core:notice] [pid 20728] AH00094: Command line: ‘/usr/sbin/apache2’
Create a WorkFlow for Leads Module, run “Only on Save”, with “Condition” “Last name” “contains” “Greenspan”, with “Action” “ModifyRecord”, “Description” “Touched by a workflow”, then edit the “Lucia Greenspan” record.
The Description won’t change.
Then change the “Condition” to “reenspan”; Save the lead and the Description will change.
Meanwhile (and I can’t test against the online demo since it doesn’t appear to have task scheduler turned on) the cli php that runs from the task scheduler matches the full string as part of the “Contains” condition.
My personal expectation was that “Contains” can include the beginning of the string, not strictly a substring, but only does when called from the scheduler, (and not by the OnSave).
Thanks @pgr. I’ve looked at the github topic and posted there; I don’t think the two are related.
I haven’t yet submitted a new Issue on Github, but I will within a couple of weeks. There are some other issues within the workflow module, related to time calculations and triggers I need to explore first (and get repeatable issues with first).