CoreBOSBB
Having problems with workflows on I module I created - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Development (https://discussions.corebos.org/forumdisplay.php?fid=18)
+--- Forum: coreBOS Development (https://discussions.corebos.org/forumdisplay.php?fid=4)
+--- Thread: Having problems with workflows on I module I created (/showthread.php?tid=907)



Having problems with workflows on I module I created - Guido1982 - 02-20-2018

I am having some issues on a module I created some time ago. The workflows don't always fire, and I have no idea why. Does anyone have any tips on how to debug this? I've noticed this on workflows that send e-mails in particular so far. Other modules don't have this problem.


RE: Having problems with workflows on I module I created - joebordes - 02-20-2018

Activate the debug and background logs. Look there and in the apache error log in search of some SQL error.
Also look in the com_workflow_queue to see if the emails actually get into the queue or not. Depending on that the error will be in the save or in the workflow.


RE: Having problems with workflows on I module I created - Guido1982 - 02-21-2018

Let me check the queue and get back to you

I checked, the workflow DOES trigger the addition of a row in 'com_vtiger_workflow_task_queue', the ID is correct and 'do_after' is set to 0. When I execute the cron script, the task gets removed from the table, but no e-mail gets sent.


RE: Having problems with workflows on I module I created - joebordes - 02-21-2018

Then the problem is with the workflow.

Activate Debug_Send_EMail global variable and check the output of the actual sending.

You could also try evalwf.php on the email task to see what it has to say


RE: Having problems with workflows on I module I created - Guido1982 - 02-21-2018

Sadly I don't have that GV yet. Still need to update this installation, but I want to include the new inventorylines in the update.

I don't know how to use evalwf.php. I presume I should use it from the command line? And what should I pass as a parameter?

Ah, wait. I see the file is documented in build/HelperScripts

The evalwf.php script says (note that I removed the domain name):

Code:
Launch Conditions:
** RESULT:
bool(true)

** EMail TASK **

from_name
guido
from_email
crm@DOMAIN.nl
to_email
guido@DOMAIN.nl
cc

bcc

subject
Guido maakte een opmerking bij keuring KEU000001
content

Bij keuring KEU000001 werd een opmerking gemaakt door een monteur: TEST2
This seems to be in order as far as I can see.

This is the content of the task (note again that the DOMAIN stands for the actual domain, I removed it here):

Code:
O:11:"VTEmailTask":15:{s:18:"executeImmediately";b:0;s:10:"workflowId";s:3:"115";s:7:"summary";s:64:"Verstuur een e-mail als de opmerking van de monteur veranderd is";s:6:"active";b:1;s:7:"trigger";N;s:8:"fromname";s:20:"crm@DOMAIN.nl";s:9:"fromemail";s:20:"crm@DOMAIN.nl";s:7:"replyto";s:36:"$(assigned_user_id : (Users) email1)";s:7:"subject";s:89:"$(assigned_user_id : (Users) first_name) maakte een opmerking bij keuring  $servicejob_no";s:7:"content";s:159:"<p>Bij keuring <a href="$(general : (__VtigerMeta__) crmdetailviewurl)">$servicejob_no</a> werd een opmerking gemaakt door een monteur: $mechanic_remarks</p>
";s:9:"recepient";s:22:"guido@DOMAIN.nl";s:7:"emailcc";s:0:"";s:8:"emailbcc";s:0:"";s:4:"test";s:122:"[{"fieldname":"mechanic_remarks","operation":"has changed","value":"","valuetype":"","joincondition":"and","groupid":"0"}]";s:2:"id";i:144;}

I have no idea how, but it started working on one workflow. I changed the workflow task a couple of times and it started to work. Right now it's back at where I started at, and even that works.


RE: Having problems with workflows on I module I created - joebordes - 02-21-2018

It is the "from name" that has to be a valid email or most SMTP servers will reject the email

There is currently a validation in the outgoing server configuration to impose that but it was added a 6/7 months ago so you may not have that validation.

I recommend always leaving "from" empty, it is used in very scarce use cases.

Let us know how it goes.


RE: Having problems with workflows on I module I created - Guido1982 - 02-21-2018

I noticed something else on both workflows that have problems. Both use the 'has changed' clause. I don't know how this compares values against previous values (modtracker is enabled for this module), but it doesn't seem to work for me. Note that this install is pretty old (I know), so maybe there have been changes to this code in the recent past?

Is there any way I can check what this method actually does and how I could 'repair' it?

(02-21-2018, 09:53 AM)joebordes Wrote: It is the  "from name" that has to be a valid email or most SMTP servers will reject the email

There is currently a validation in the outgoing server configuration to impose that but it was added a 6/7 months ago so you may not have that validation.

I recommend always leaving "from" empty, it is used in very scarce use cases.

Let us know how it goes.

Yeah I figured that as well, but that works. Just to be sure I'll leave it blank, so future updates don't break workflows.

I've now changed the workflows to avoid the 'has changed' clause. In stead I use 'the first time a condition is true', and then execute a task. I'd rather create a workflow that takes a broader perspective and narrows down when it comes down to the tasks, but let's see if this works first.