processmakerlover wrote:I tried your process and it is really great but there is one simple problem for me. I want to delete the case not open the other case of next task(task3). I want to delete it after sending a case in task2.
You can set the trigger to close all the other open threads in task2. You don't need to create a task3.
processmakerlover wrote:I want to delete(complete) after sending(submit) case because if it deletes(completes) after opening case in task3, until open the case in task3, maybe can drop new case with the same case id and case number thanks to look(in my real process cases come from loop in this process there isn't any problem like it) so the new case delete with the data.
Your English is not very clear, so I'm not sure what you are trying to do.
You can only
delete a case when it is in the starting task (either with the menu
Action > Delete or PMFDeleteCase() in a trigger), meaning that the case is removed from the database and there will be no record of it. After the first task in the case, you can only
cancel the case (either with the menu
Action > Cancel or PMFCancelCase() in a trigger), meaning that the case stays in the database, but it no longer appears in the list under
Home > Inbox and
Home > Drafts, but it is still listed as read-only under
Home > Participated and
Home > Advanced Search.
Canceling a case will prevent all open tasks from being routed to the next task, but you need to specify the delegation index for each open task to remove them from the lists under Home > Inbox and Home > Draft. In your example, you have two open threads, so you need to cancel both of them like this:
Code: Select all//cancel the current task:
PMFCancelCase(@@APPLICATION, @%INDEX);
//cancel the open task in the case's other thread:
$sql = "SELECT * FROM APP_DELEGATION WHERE APP_UID='$caseId' AND DEL_THREAD_STATUS='OPEN'
AND DEL_INDEX<>".@@INDEX;
$aTasks = executeQuery($sql);
foreach ($aTasks as $aTask) {
PMFCancelCase(@@APPLICATION, $aTask['DEL_INDEX']);
}
//redirect to the case list and die:
header("location: casesListExtJsRedirector");
die();
You can't use the same case number in multiple cases, but you can have the same case with multiple threads.