Discussion about developing the ProcessMaker application and suggestions for improving it

Moderator: amosbatto

User avatar
By bobPuebla
#822221
Hi! I have a problem with scheduled tasks. The problem is that despite the tasks seem to be executed, the scripts don't perform any action

In this process there are 3 different scheduled cases running all the time. They run in a endless loop with an intermediate timer event and a script task which executes once a day, one of these scripts executes PMFNewCase, in order to create new cases according to predefined structure. The other two tasks send notifications using PMFSendMessage
image192.png
image192.png (29.85 KiB) Viewed 82 times
each task seem to be executed correctly by intermediate timers, but scripts don't perform any action. If I run those scripts manually they perform perfectly
Selección_076.png
Selección_076.png (24.86 KiB) Viewed 91 times
I 'd really appreciate your help
Attachments
Selección_075.png
Selección_075.png (43.54 KiB) Viewed 91 times
User avatar
By amosbatto
#822233
Have you set up your ProcessMaker server to periodically execute the timereventcron.php file, as a cron job in Linux or a Scheduled Task in Windows? See: https://wiki.processmaker.com/3.2/Executing_cron.php
(If you are using LInux, make sure that you read the documentation about how to properly execute the file.)

If you can't get it to work, post how you set up your cron job or Scheduled Task.
User avatar
By bobPuebla
#822263
thanx for your answer amosbatto

Well, I believe that it was properly executed. The cron status indicates Active and there are events listed, look at the cron actions log:
image72.png
image72.png (106.7 KiB) Viewed 70 times
User avatar
By amosbatto
#822264
If you execute the timereventcron.php file manually, do you see any errors when those script tasks are executed?
Have you executed the triggers in those script tasks as normal triggers inside a normal task to verify that they work? Run with the debugger enabled to see whether there were any errors.

Some system variables aren't updated correctly in script tasks. From the documentation:
Note: The system variables which are available during a script task are the variables that were set during the previous normal task in the process, so the value of the @@USR_USERNAME and @@USER_LOGGED variables will be set to the last user who worked on the case. Similarly, @%INDEX will be set to the delegation index of the previous normal task in the process. If the delegation index of the current script task is necessary, then it will be @%INDEX + 1 if the script task follows a normal task, or @%INDEX + 2 for the second script task after a normal task.
If none of those things is the problem and you can't figure it out, then you can always create three PHP files to execute the triggers using web services. Each of the files would have code like the following:
Code: Select all
<?php
ini_set("soap.wsdl_cache_enabled", "0");
ini_set('error_reporting', E_ALL);
ini_set('display_errors', True);

//If not executing this on your ProcessMaker server, then change the domain/IP address:
$client = new SoapClient('http://localhost/sysworkflow/en/neoclassic/services/wsdl2'); 
$username = 'admin'; //set to username
$pass = '[email protected]';  //set to password
$params = array(array('userid'=>$username, 'password'=>$pass));
$result = $client->__SoapCall('login', $params);

if ($result->status_code == 0)
   $sessionId = $result->message;
else
   print "Unable to connect to ProcessMaker.\nError Number: $result->status_code\n" .
         "Error Message: $result->message\n";

$params = array(array(
   'sessionId'=>$sessionId, 
   'caseId'=>'9782409664a7c94433d0920003544388',  //set to the ID of the case
   'triggerIndex'=>'3126831054a7dd8781e84a7046772575',  //set to ID of trigger
   'delIndex'=>'1' 
));
$result = $client->__SoapCall('executeTrigger', $params);

if ($result->status_code != 0)
   print "Error: $result->message \n";
?>
Then, your process to execute the trigger would be just a single task:
singleTaskProcess.png
singleTaskProcess.png (10.19 KiB) Viewed 63 times
Then, start a case with the debugger enabled to see the Case ID in the APPLICATION system variable, so you can set it in the above code. Don't end the case, so it will be open forever and triggers can be executed in it forever.

i sure it is very interesting and entertaint for y[…]

ok, Where should I set the TRIGGER in this simple[…]

No clue. I've never tried using that. You can cha[…]

When you are inside the ProcessMaker interface and[…]