- Mon Nov 26, 2018 4:49 am
#818790
hi all,
i got a weird acting trigger today. i wrote a trigger and a template for reminder mail focused on this topic viewtopic.php?t=709185.the trigger is
i copy amos's overDueCases.php file to execute the trigger everyday.
i searched the problem more deeply and saw it, when i go manually second query works well.
when i go task schedular, it searched depands on first UID it get.
is it possible to trigger act weird at cases or Task Scheduler?
btw i tried this topic too viewtopic.php?t=730533 same failure i get
When i run a case by myself When i execute task Scheduler
i got a weird acting trigger today. i wrote a trigger and a template for reminder mail focused on this topic viewtopic.php?t=709185.the trigger is
Code: Select all
and the template is $now = date("Y-m-d H:i:s");
function encode_items($arr) {
foreach ($arr as $n => $v) {
if (is_array($v)) {
$arr[$n] = encode_items($v);
} else {
$arr[$n] = mb_convert_encoding($v, 'UTF-8', 'AUTO');
}
}
return $arr;
}
header('Content-Type: text/html; charset=UTF-8');
$query1 = "select USR_UID,APP_CURRENT_USER FROM APP_CACHE_VIEW
where APP_STATUS='TO_DO' AND DEL_THREAD_STATUS='OPEN' AND '$now' > DEL_TASK_DUE_DATE GROUP BY USR_UID";
$result1 = executeQuery($query1);
$result1 = encode_items($result1);
@=US = $result1;
for ($j = 1; $j <= count(@=US); $j++) {
$US02 = @=US[$j]['USR_UID'];
@=GS = NULL;
$query2 = "select APP_CURRENT_USER GS01,CONCAT(APP_NUMBER,' ',APP_TITLE) AS GS02,APP_TAS_TITLE AS GS03,TIMESTAMPDIFF(HOUR, DEL_TASK_DUE_DATE, NOW()) AS GS04 FROM APP_CACHE_VIEW
where APP_STATUS='TO_DO' AND DEL_THREAD_STATUS='OPEN' AND '$now' > DEL_TASK_DUE_DATE AND USR_UID='$US02' ORDER BY APP_CURRENT_USER";
$result2 = executeQuery($query2);
$result2 = encode_items($result2);
@=GS = $result2;
$aUser = userInfo($US02);
$manager = userInfo($aUser['reportsto']);
@@return = PMFSendMessage(@@APPLICATION, "PM Alert <info@kc.com>", $aUser['mail'], "", "", " OverDue Cases", "overDueCases.html", array(''), array(''), true, 0, "");
};
Code: Select all
everything is working well when i execute case by myself, and it sends each employee's overduecases to them<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
</head>
<body>
<p>Overdue Cases ::</p>
<table border="1" style="height: 5mm; width: 180mm;">
<tbody>
<tr>
<td><font size="1"><b>Cases</b></font></td>
<td><font size="1"><b>Tasks</b></font></td>
<td><font size="1"><b>Overtime</b></font></td>
</tr>
<!--@>GS-->
<tr>
<td><font size="1">@#GS02</font></td>
<td><font size="1">@#GS03</font></td>
<td style="width: 15mm; height: 5mm;"><font size="1">@#GS04 Saat</font></td>
</tr>
<!--@<GS--></tbody>
</table>
<p></p>
</body>
</html>
i copy amos's overDueCases.php file to execute the trigger everyday.
Code: Select all
when it execute trigger with task schedule, the trigger sends same template which is the first UID's overduecases to each employee.<?php
$serverAddress = "http://192.168.2.220"; //set to the server's address
$workspace = 'kozacarpet'; //set to the workspace which is 'workflow' by default
$user = 'bot'; //set to user who is assigned to a case in the process to run trigger
$password = '*******'; //set to password of the user
$caseId = '1107177735bf7e765674222073532032'; //set to case's ID
$triggerId = '6296691895bfba2063e64d7096382547'; //set to the trigger's ID
ini_set("soap.wsdl_cache_enabled", "0");
ini_set('error_reporting', E_ALL);
ini_set('display_errors', True);
$client = new SoapClient("$serverAddress/sys$workspace/en/neoclassic/services/wsdl2");
$md5Pass = 'md5:'. hash('sha256',$password);
$params = array(array('userid'=>$user, 'password'=>$md5Pass));
$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";
#look up the caseId and delIndex with the caseList() web service and the triggerIndex in MySQL
$params = array(array(
'sessionId' => $sessionId,
'caseId' => $caseId,
'triggerIndex' => $triggerId,
'delIndex' => '1' //assuming first task in case
));
$result = $client->__SoapCall('executeTrigger', $params);
if ($result->status_code != 0)
print "Error: $result->message \n";
else
print_r($result);
?>
i searched the problem more deeply and saw it, when i go manually second query works well.
when i go task schedular, it searched depands on first UID it get.
Code: Select all
this line stay still i tried foreach fucntion too. manuel works change this line and task scheduler hold same this line.$US02 = @=US[$j]['USR_UID'];
is it possible to trigger act weird at cases or Task Scheduler?
btw i tried this topic too viewtopic.php?t=730533 same failure i get
When i run a case by myself When i execute task Scheduler