Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderator: ArturoRobles

By marcosfpa
#789630
I'm having trouble setting up and using subprocesses. Use version 3.1.3. What happens is that I create a normal process and in the middle of it there is a subprocess call and after it the main process goes on with tasks and so on. But when my case arrives in the subprocess it creates the normal subprocess task and at the same time already creates the task that would be after the subprocess, I have already tried to set up the subprocess as Synchronous and Asynchronous and nothing. .
What can it be?
By Vvladimir
#789852
Hello

I commented that in version 3.1.3 the operation of the sub processes, their types and the operation is correct, so that the sub-process is not executed using the Synchronous type.

Regards.
By mauromero
#789911
I have the same problem. Every time the flow goes into the subprocess task, In the inbox I have the subprocess which it's only a button to go to the first task of the subprocess, and I also have the first task of the subprocess in my inbox. But also, when I click the button in the subprocess, it duplicates the first task. So I now in my inbox I have 2 first tasks of the subprocess.
User avatar
By amosbatto
#789913
marcosfpa wrote: I'm having trouble setting up and using subprocesses. Use version 3.1.3. What happens is that I create a normal process and in the middle of it there is a subprocess call and after it the main process goes on with tasks and so on. But when my case arrives in the subprocess it creates the normal subprocess task and at the same time already creates the task that would be after the subprocess, I have already tried to set up the subprocess as Synchronous and Asynchronous and nothing. .
What can it be?
Marcos, I can't replicate this problem using PM 3.1.3 Community Edition. If the subprocess is Asynchronous then I see both the master process case and the subprocess case in the inbox, which is the way it should be. If the subprocess is Synchronous, then I only see the subprocess case. Once the subprocess case finishes, then I see just the master process case in my inbox, which is the way it should be. Attached are the two processes I used:
(62.82 KiB) Downloaded 266 times
(18.85 KiB) Downloaded 256 times
Marcos, if you are seeing something different please provide screenshots and your process so we can test it.
mauromero wrote:I have the same problem. Every time the flow goes into the subprocess task, In the inbox I have the subprocess which it's only a button to go to the first task of the subprocess, and I also have the first task of the subprocess in my inbox. But also, when I click the button in the subprocess, it duplicates the first task. So I now in my inbox I have 2 first tasks of the subprocess.
Mauromero, I don't see the duplicate first task. Can you provide screenshots and upload your process, so the developers can test it.
By mauromero
#789934
Thanks for replying, although my question was answered with you reply: "is the way it should be", I'm going to explain my case.
I also opted for another way to achieve the same result (not my favorite one though). The one explained in "A Variable Number of Parallel Tasks":
http://wiki.processmaker.com/3.0/Trigge ... llel_Tasks

So I repeat, I was trying the following, but opted for the solution above ("A Variable Number of Parallel Tasks").

I have a process just like the one explained in "Repeating a Task with a Loop-Around"
http://wiki.processmaker.com/3.0/Trigge ... oop-Around
PM3.0TriggerExampleTaskLoopDiagram.png
PM3.0TriggerExampleTaskLoopDiagram.png (9.59 KiB) Viewed 10169 times
But my process has a subprocess instead
process-01.png
process-01.png (19.3 KiB) Viewed 10169 times
My subprocess contains just a few tasks
subprocess.png
subprocess.png (13.54 KiB) Viewed 10169 times
When Task1 is executed, User1 inbox gets 2 cases: the subprocess itself (repeat) and the first task of it (sub1)
inbox-01.png
inbox-01.png (15.26 KiB) Viewed 10169 times
When I open the repeat task, it's just the button to continue with the first task of the subprocess(sub1)
assign_task.png
assign_task.png (9.77 KiB) Viewed 10169 times
But then I have a repeated "sub1" task
inbox-02.png
inbox-02.png (17.71 KiB) Viewed 10169 times
The code is the same as shown in the example "Repeating a Task with a Loop-Around" from wiki.processmaker.com. The loop works well only when I skip the "repeat" task in my inbox and execute the "sub1" alone.

Thank you!
User avatar
By amosbatto
#790419
Mauromero and Marcos,
I just tried this again and everything is working correctly in PM 3.1.3 Community.
If you choose ASYNCHRONOUS, then you will see 2 cases in the inbox from both the master case and the subprocess case.

If you choose SYNCHRONOUS , then you will see only 1 case in the inbox.

I tried it with a repeating loop as in Mauromero's process and I still only see 1 case in the inbox with each loop when it is SYNCHRONOUS.

Are you guys sure that you are using a SYNCHRONOUS subprocess?
By marcosfpa
#790459
The problem that happens is that when using SYNCHRONOUS it generates the 2 tasks in the input box and if the user performs the task of tracking the subprocess it ends up generating another task from the main process, leaving 2 main process tasks in the box input. This is strange because in this way the user must be careful not to perform this task ...
User avatar
By amosbatto
#790469
Marcos, Please provide a process that I can test and explain the exact steps you do to see multiple tasks in the Inbox. We have to be able to replicate the problem to fix it.
By lavoie23
#790714
Same problem here. Attached, the two processes that I used as a test.

The first one, here's the first one (TROUBLESHOOT_MAIN_PROCESS) :
1_main_process.png
1_main_process.png (10.45 KiB) Viewed 9996 times
The second one is the subprocess :
2_called_process.png
2_called_process.png (5.3 KiB) Viewed 9996 times
Note that the subprocess has been set to be synchronous.

Here's what happen immediately after Task 1 :
3_two_tasks.png
3_two_tasks.png (29.12 KiB) Viewed 9996 times
Attachments
(19.65 KiB) Downloaded 205 times
(35.42 KiB) Downloaded 208 times
User avatar
By amosbatto
#790721
Hi lavoie23,
I just ran cases in your processes in PM 3.1.3 Community in Debian 8.4. I see one case in the TROUBLESHOOT_MAIN_PROCESS in the Inbox or one case in the TROUBLESHOOT_CALLED_SUBPROCESS, but I never see the two cases at the same time in the Inbox like you have in your screen shot

I can see two cases at the same time if I go to Home > Participated or Home > Advanced Search, but that is normal. You should be able to see two cases because Participated and Advanced Search show both open and closed cases. However, you should only be able to see one case at a time in Home > Inbox, Home > Draft, Home > Unassigned and Home > Paused. Are you seeing something different?
By lavoie23
#790766
Yes, in fact the screenshot I posted is what I see in my Inbox.

I wasn't sure what to think of it initially, but now it really seems like a bug.
User avatar
By amosbatto
#790768
I am not seeing any problems using the "admin" user with the PROCESSMAKER_ADMIN role. What role does your user have where you are seeing this problem?
User avatar
By amosbatto
#790777
Please file a bug report about it and make sure that you list your exact configuration and provide processes to test it. Maybe the developers will be able to replicate it.
By marcosfpa
#793225
It's a BUG in version 3.2 and it looks like we have to wait for version 3.2.1. Are there any predictions for this to happen?

While launching does not occur, is there any way to work around this problem in any way? How to change some system source code myself?

It's because this behavior is very inconvenient ...
User avatar
By amosbatto
#795642
Bilal, you can use PMFNewCase() in a trigger to start your five cases. Create a group named "Subprocess Users" and assign the five users who will be assigned to the first task in the subprocess to that group. Then can place a trigger like the following to fire in the master process:
Code: Select all
//set to the ID of the process where new cases will be started:
$processId = '173399423592dfc0f33a4f0098711358';
//set to the ID of the first task in the process:
$firstTaskId = '1919025015989cc34c84445034982382';

//variables to pass to the new case:
$aVars = array(
   'parentCaseId'  => @@APPLICATION,
   'userParentCase'=> @@USER_LOGGED,
   'var1'          => @@var1,
   'var2'          => @@var2
);

//Get users to assign to the subprocess:
$groupId = PMFGetGroupUID('Subprocess Users'); 
$aAssignedUsers = PMFGetGroupUID($groupId);
$feedback = ''; 
$oCase = new Cases();

//create cases for each member of the "Subprocess Users" group:
foreach ($aAssignedUsers as $aUser) {
    $assignedName = $aUser['USR_FIRSTNAME'] .' '. $aUser['USR_LASTNAME'];
    $newCaseId = PMFNewCase($processId, $assignedUserId, $firstTaskId, $aVars);
    if ($newCaseId) {
      $aCaseInfo = $oCase->LoadCase($newCaseId, 1);
      $feedback .= (empty($feedback) ? '' : "\n") .
          "New case #{$aCaseInfo['APP_NUMBER']} assigned to $assignedName";
   }
   else {
     $feedback .= (empty($feedback) ? '' : "\n") . "Error assigning case to $assignedName";
   }
}
$g = new G();
$g->SendMessageText($feedback, "INFO");
 
In your subprocess, you can add the following trigger to send variables back to the parent case, when concluding the subprocess:
Code: Select all
//send variables back to the parent case:
$aVars = array(
   "var3" => @@var3,
   "var4" => @@var4
);
PMFSendVariables(@@parentCaseId, $aVars); 
By bilalk
#795654
amosbatto wrote:Bilal, you can use PMFNewCase() in a trigger to start your five cases. Create a group named "Subprocess Users" and assign the five users who will be assigned to the first task in the subprocess to that group. Then can place a trigger like the following to fire in the master process:
Code: Select all
//set to the ID of the process where new cases will be started:
$processId = '173399423592dfc0f33a4f0098711358';
//set to the ID of the first task in the process:
$firstTaskId = '1919025015989cc34c84445034982382';

//variables to pass to the new case:
$aVars = array(
   'parentCaseId'  => @@APPLICATION,
   'userParentCase'=> @@USER_LOGGED,
   'var1'          => @@var1,
   'var2'          => @@var2
);

//Get users to assign to the subprocess:
$groupId = PMFGetGroupUID('Subprocess Users'); 
$aAssignedUsers = PMFGetGroupUID($groupId);
$feedback = ''; 
$oCase = new Cases();

//create cases for each member of the "Subprocess Users" group:
foreach ($aAssignedUsers as $aUser) {
    $assignedName = $aUser['USR_FIRSTNAME'] .' '. $aUser['USR_LASTNAME'];
    $newCaseId = PMFNewCase($processId, $assignedUserId, $firstTaskId, $aVars);
    if ($newCaseId) {
      $aCaseInfo = $oCase->LoadCase($newCaseId, 1);
      $feedback .= (empty($feedback) ? '' : "\n") .
          "New case #{$aCaseInfo['APP_NUMBER']} assigned to $assignedName";
   }
   else {
     $feedback .= (empty($feedback) ? '' : "\n") . "Error assigning case to $assignedName";
   }
}
$g = new G();
$g->SendMessageText($feedback, "INFO");
 
In your subprocess, you can add the following trigger to send variables back to the parent case, when concluding the subprocess:
Code: Select all
//send variables back to the parent case:
$aVars = array(
   "var3" => @@var3,
   "var4" => @@var4
);
PMFSendVariables(@@parentCaseId, $aVars); 
ty for replying but there is a misunderstanding. for my problem i have to start up to 5 same cases, it is generaly 2 or 3, with same employee. 5 cases have different topics but same case same employee.

and there is another case , the assigment rules is manual assigment icludes everybody in our system.

with that code i can only start a case and cant assign who i really want to:/
User avatar
By amosbatto
#795667
bilalk wrote:ty for replying but there is a misunderstanding. for my problem i have to start up to 5 same cases, it is generaly 2 or 3, with same employee. 5 cases have different topics but same case same employee.

and there is another case , the assigment rules is manual assigment icludes everybody in our system.

with that code i can only start a case and cant assign who i really want to:/
Add a dropdown to a DynaForm with the ID "selectUserForCases" where the keys are the usernames of people assigned to the first task in the other process.

Add a dropdown whose ID is "numberOfCases" which has the following keys: 0, 1, 2, 3, 4, 5

Then add this trigger after the DynaForm:
Code: Select all
//set to the ID of the process where new cases will be started:
$processId = '173399423592dfc0f33a4f0098711358';
//set to the ID of the first task in the process:
$firstTaskId = '1919025015989cc34c84445034982382';

//variables to pass to the new case:
$aVars = array(
   'parentCaseId'  => @@APPLICATION,
   'userParentCase'=> @@USER_LOGGED,
   'var1'          => @@var1,
   'var2'          => @@var2
);

if (!empty(@@selectUserForCases) and @#numberOfCases != 0) {
   //look up ID of selected user:
   $sql = "SELECT USR_UID FROM USERS WHERE USR_USERNAME='"[email protected]@selectUserForCases."'";
   $result = executeQuery($sql);
   if (empty($result)) {
     throw new Exception("Unable to find user '"[email protected]@selectUserForCases."' in USERS table.");
   }
   
   $feedback = ''; 
   $oCase = new Cases();

   //create number of selected cases:
   for ($i = 0; $i < @#numberOfCases; $i++) {
      $assignedName = $aUser['USR_FIRSTNAME'] .' '. $aUser['USR_LASTNAME'];
      $newCaseId = PMFNewCase($processId, $assignedUserId, $firstTaskId, $aVars);
      if ($newCaseId) {
         $aCaseInfo = $oCase->LoadCase($newCaseId, 1);
         $feedback .= (empty($feedback) ? '' : "\n") .
            "New case #{$aCaseInfo['APP_NUMBER']} assigned to $assignedName";
      }
      else {
         $feedback .= (empty($feedback) ? '' : "\n") . "Error assigning case to $assignedName";
      }
   }
   $g = new G();
   $g->SendMessageText($feedback, "INFO");
}  
By bilalk
#795673
amosbatto wrote:
bilalk wrote:ty for replying but there is a misunderstanding. for my problem i have to start up to 5 same cases, it is generaly 2 or 3, with same employee. 5 cases have different topics but same case same employee.

and there is another case , the assigment rules is manual assigment icludes everybody in our system.

with that code i can only start a case and cant assign who i really want to:/
Add a dropdown to a DynaForm with the ID "selectUserForCases" where the keys are the usernames of people assigned to the first task in the other process.

Add a dropdown whose ID is "numberOfCases" which has the following keys: 0, 1, 2, 3, 4, 5

Then add this trigger after the DynaForm:
Code: Select all
//set to the ID of the process where new cases will be started:
$processId = '173399423592dfc0f33a4f0098711358';
//set to the ID of the first task in the process:
$firstTaskId = '1919025015989cc34c84445034982382';

//variables to pass to the new case:
$aVars = array(
   'parentCaseId'  => @@APPLICATION,
   'userParentCase'=> @@USER_LOGGED,
   'var1'          => @@var1,
   'var2'          => @@var2
);

if (!empty(@@selectUserForCases) and @#numberOfCases != 0) {
   //look up ID of selected user:
   $sql = "SELECT USR_UID FROM USERS WHERE USR_USERNAME='"[email protected]@selectUserForCases."'";
   $result = executeQuery($sql);
   if (empty($result)) {
     throw new Exception("Unable to find user '"[email protected]@selectUserForCases."' in USERS table.");
   }
   
   $feedback = ''; 
   $oCase = new Cases();

   //create number of selected cases:
   for ($i = 0; $i < @#numberOfCases; $i++) {
      $assignedName = $aUser['USR_FIRSTNAME'] .' '. $aUser['USR_LASTNAME'];
      $newCaseId = PMFNewCase($processId, $assignedUserId, $firstTaskId, $aVars);
      if ($newCaseId) {
         $aCaseInfo = $oCase->LoadCase($newCaseId, 1);
         $feedback .= (empty($feedback) ? '' : "\n") .
            "New case #{$aCaseInfo['APP_NUMBER']} assigned to $assignedName";
      }
      else {
         $feedback .= (empty($feedback) ? '' : "\n") . "Error assigning case to $assignedName";
      }
   }
   $g = new G();
   $g->SendMessageText($feedback, "INFO");
}

i did what you told me but there is a error
error.png
error.png (25.7 KiB) Viewed 8954 times
,
User avatar
By amosbatto
#795676
Did you bother to investigate?
Turn on Debug Mode and look at the @@__ERROR__ variable. Turn on debug mode in your env.ini file and check the log files. If that doesn't tell you anything then assign your local variables to case variables, so you can see them in your debugger and figure out what you are passing to PMFNewCase().
Manual email send out did not run.

Dear All, Sometimes email stuck in pending when p[…]

DELETE A OUTPUT DOCUMENT

I solve the problem using this trigger $caseId =[…]

First off I am new to processmaker. I am trying to[…]

Total of grid in integer

Hi, Is there any better way to do it instead of c[…]