Page 1 of 1

Strange issue with message: " The case has not stopped due to its trigger".

Posted: Fri Jun 14, 2019 10:36 am
by zeiscas
Hi,
There were some strange issues happening with duplicate cases created (PMFCreateNewCase()) by a trigger fired on "before routing" and I'm assuming this could be due to the use of Edge (or other) browser different from Firefox! Do you have any tip?
Now, I need to pause (i wanted to cancel or delete if possible?) these cases and the system is poping up the error message: "The case has not stopped due to its trigger".
What it's happening here?
Thank you very much.

Re: Strange issue with message: " The case has not stopped due to its trigger".

Posted: Fri Jun 14, 2019 12:22 pm
by amosbatto
The error is caused when a database record hasn't been created for the case in the APP_THREAD table, so I assume that your trigger had an error or hasn't completed, so it prevented the creation of the record.

Post the code for your trigger.

Re: Strange issue with message: " The case has not stopped due to its trigger".

Posted: Fri Jun 14, 2019 3:56 pm
by zeiscas
Thanks Amos.
See the code below:
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
	);
	
	$newCaseId = PMFNewCase($processId, $userLogged, $taskId, $aData, "TO_DO");
	//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);
	//}
}

Re: Strange issue with message: " The case has not stopped due to its trigger".

Posted: Fri Jun 14, 2019 5:09 pm
by amosbatto
Make sure that all the users who can execute that trigger are also in the assignment list for the starting task of the new cases. I don't see anything else that might cause a problem.

Have you tried moving your trigger to execute before assignment?

Re: Strange issue with message: " The case has not stopped due to its trigger".

Posted: Sun Jun 16, 2019 10:36 am
by zeiscas
Hi Amos,
Thanks again.
The next task is a "Value based assignment" and it is working fine for other users, but for this (it happen also with another) there are duplicated cases (it seems the trigger is executed more than once!). I suspected that it might be the Browser and I suggested to use Firefox (the one I use and never happen this in my tests) instead of Chrome. I also found out some issues with Edge (losing data on the swimlanes: disapearing tasks, assignment rules, flows).
For now, I just wanted to fix these Cases; removing them from inbox. Either by cancelling or pausing. The error appears when I tried to Pause. How can I do that?
Thanks.

Re: Strange issue with message: " The case has not stopped due to its trigger".

Posted: Mon Jun 17, 2019 1:47 pm
by amosbatto
You can manually create a record for the case in the APP_THREAD table, so that the case can be canceled or paused.

If you can't figure out what values to put in the APP_THREAD table, then I recommend that you simply delete the records for this case in the APP_DELEGATION, APP_CACHE_VIEW and APPLICATION tables to make the case disappear.

Re: Strange issue with message: " The case has not stopped due to its trigger".

Posted: Tue Jul 02, 2019 10:08 am
by zeiscas
Thank you Amos.
This method is a work around, but the Cases continue to be duplicated after the aforementioned trigger!
- The trigger creates a new case with PMF_CreateNewCase();
- It is triggered on Before routing event of a Parallel task.
- Most of the duplicates are for the same user! Other users don't have duplicated cases on same task.
- It is created 1 case for each grid row. The grid is shown Ok to the user with no duplicated rows!

Do you know any possible cause?
I found out also that the Due-date is different for the duplicated cases - see picture attached.

Re: Strange issue with message: " The case has not stopped due to its trigger".

Posted: Tue Jul 02, 2019 6:23 pm
by amosbatto
zeiscas wrote: Tue Jul 02, 2019 10:08 am This method is a work around, but the Cases continue to be duplicated after the aforementioned trigger!
- The trigger creates a new case with PMF_CreateNewCase();
- It is triggered on Before routing event of a Parallel task.
- Most of the duplicates are for the same user! Other users don't have duplicated cases on same task.
- It is created 1 case for each grid row. The grid is shown Ok to the user with no duplicated rows!

Do you know any possible cause?
This is bizarre. PMF_CreateNewCase() doesn't exist. Are you talking about PMFNewCase()? I recommend trying PMFNewCaseImpersonate() because it doesn't change the system variables.

There is a bug with triggers fired during routing in recent versions of PM. If you have multiple before routing triggers, then you need combine them into one trigger. What version of PM are you using?

Do you mind posting your trigger code?

Re: Strange issue with message: " The case has not stopped due to its trigger".

Posted: Wed Jul 03, 2019 11:29 am
by zeiscas
Thank you Amos.
Yes, I misspelled the name of the trigger! I already posted the trigger at the beggining of this thread. The version is 3.2.1 in Windows 2016.

Cheers.

Re: Strange issue with message: " The case has not stopped due to its trigger".

Posted: Thu Jul 04, 2019 12:37 am
by amosbatto
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

Re: Strange issue with message: " The case has not stopped due to its trigger".

Posted: Mon Jul 08, 2019 11:16 am
by zeiscas
Thanks.

Re: Strange issue with message: " The case has not stopped due to its trigger".

Posted: Mon Jul 08, 2019 8:25 pm
by amosbatto
Did my code change fix it?

Re: Strange issue with message: " The case has not stopped due to its trigger".

Posted: Thu Jul 11, 2019 7:06 am
by zeiscas
Hi Amos,
I'm still trying to figure out what's going on. Client complaint about "duplicated cases" and I assumed it was due to this Trigger because it was the first ones we discovered. But I had changed the trigger position from "before assignment" to "before routing", and I guess, it worked out. But they were still complaining without identifying the Process/Task.
Then I found that it were appearing "ghost" cases when the process derivates to a sub-process. This "ghost" disapeared after the case returned to the main process. I applied that miraculous code on APP_DELEGATION. Insert trigger and this issue seems to be sorted out.
Now, I understood that they also have duplicated Case numbers!! (see picture). This one happen after first task and it is a simple Cycle derivation rule for 1 user (Director general). In all tasks I have groups of users assigned (most of them have only one user for now), but this task has only the user.
I'm using Processmaker 3.2.1 with multilanguage (English and Georgian).
Thanks for help.