executeQuery() has problems with ` (backticks) and ; (semicolons) in some circumstances. Also try resetting your system variables after calling PMFNewCase().
Try this:
Code: Select all//TRIGGER
$taskId = '1986389165ba25200c004b7024400992'; //set to starting task's unique ID
$processId = PMFGetProcessUidByName("განყოფილების მომსახურება"); //set to the process' unique ID
//$processId = PMFGetProcessUidByName("Service at Division"); //set to the process' unique ID
$userLogged = @@USER_LOGGED;
//Only the rows not marked as Refused will generate services. They were removed before
for ($j = 1; $j <= count(@=gridDivision); $j++) {
$aData = array(
'OrderID' => @%OrderID,
'OrderNumber' => @@OrderNumber,
'OrderCustomerNumber' => @@OrderCustomerNumber,
'ContractID' => @%ContractID,
'ContractNumber' => @@ContractNumber,
'ContractCustomerNumber' => @@ContractCustomerNumber,
'ContractDate' => @@ContractDate,
'TypeOfService' => @=gridDivision[$j]['TypeOfService'],
'TypeOfServiceName' => @=gridDivision[$j]['TypeOfServiceName'],
'MiName' => @=gridDivision[$j]['Title'],
'MiServiceLocal' => @=gridDivision[$j]['ServiceLocal'],
'MiSerialNumber' => @=gridDivision[$j]['SerialNumber'],
'Division' => @=gridDivision[$j]['DivisionID'],
'ServicePlanNote' => @=gridDivision[$j]['Note'],
'DivisionName' => @@DivisionUser,
'CustomerID' => @%CustomerID,
'CustomerName' => @@CustomerName,
'ContactName' => @@ContactName,
'ContactMobile' => @@ContactMobile,
'ContactEmail' => @@ContactEmail,
'CustomerAddress' => @@InvoicingAddress
);
$g = new G();
$g->sessionVarSave();
$newCaseId = PMFNewCase($processId, $userLogged, $taskId, $aData, "TO_DO");
$g->sessionVarRestore();
//This code it is needed to put the case in bold at Inbox
$user_loged = @@USER_LOGGED;
$user = @@USER_LOGGED;
$userInfo = userInfo($user_loged);
$query = "UPDATE APP_CACHE_VIEW
SET USR_UID = '$user', DEL_INIT_DATE = NULL, APP_STATUS = 'TO_DO',
PREVIOUS_USR_UID = '$user_loged',
APP_DEL_PREVIOUS_USER = '{$userInfo['lastname']} {$userInfo['firstname']}'
WHERE APP_UID = '$newCaseId'";
executeQuery($query);
}
See:
viewtopic.php?f=47&t=713218