Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By sgkalluri
#790655
Hello everyone,

I have a process where a particular task is the parallel task type. So, more than one user could be logged into the task at the same time. As it is a parallel task type, the number of users logged in to that task could vary at any point of time.

What could be the most efficient way in PM to identify who are the set of users currently logged in to that particular parallel task?

Best wishes,
SGK
By mishika
#790668
Hello,

As and when your case is routed to the Parallel task, its entries are created in the table APP_DELEGATION in the database for all the users assigned to it.
To get the users currently working on that task you can use the following trigger code:
Code: Select all
$taskid = "93657213559105a6e8942e2024745169";	//task id of the parallel task
$caseid = @@APPLICATION;						//if fetching for current case(enter the case id of the case if not the current case)
$query = "SELECT USR_USERNAME FROM APP_DELEGATION, USERS WHERE APP_UID = '$caseid' AND TAS_UID = '$taskid' AND DEL_INIT_DATE IS NOT NULL AND DEL_FINISH_DATE IS NULL AND USERS.USR_UID = APP_DELEGATION.USR_UID";
@@result = executeQuery($query);
The above SQL query searches for the entries in APP_DELEGATION table with a particular case id and task id of the parallel task. To check if the user is currently working on that task and has not completed it (users who have not started working on the task or have completed the task are not included) we have used the checks on the DEL_INIT_DATE and DEL_FINISH_DATE.

Hope this helps

Best Regards
Mishika
By sgkalluri
#790669
Thank you Mishika. Your solution does help partly.

I was keen to know if there is a way a user is logged into that task - a user may have started a task (one comes to know about it from the query that you provided), but then may have logged out of the server without completing the task.

If a user is logged in to PM system, and then navigates to this parallel task the first time at time stamp 'A', then PM would update 'A' into Del_Init_Date. But, that does not mean that the user is still on the Parallel task screen at time stamp 'A + t'. I was hoping to know if at any point of time is the user on a particular screen on PM - and in this case, the parallel task screen. If the user is on the Parallel task screen, then for how long was she/he on that screen?

The scenario of the parallel task can actually be replaced with a generalized question - how does one know when did a user enter a screen of a task and exit it?

My guess was that one has to create a separate logging system for that. However, I wanted to check if that is possible by some way using PM's existing capabilities.

Thanks again,
SGK
User avatar
By amosbatto
#790691
There is nothing built-in in PM to do exactly what you want and I don't know if there is any reliable way to do it. ProcessMaker stores the login session information in the $_SESSION variable which expires by default after 24 minutes, but one login session cannot access the $_SESSION variable of another login session for security reasons. You can query the OAUTH_ACCESS_TOKENS table to see the last time a user logged in. You have to subtract a day from the OAUTH_ACCESS_TOKENS.EXPIRES field to see when the user logged in. However, the login session may have extended beyond the 24 minutes, because new activity by a user will extend his session time for another 24 minutes.

You can add the following trigger before and after every step in your parallel task:
Code: Select all
if (!isset(@=userLog) or !is_array(@=userLog)) {
   @=userLog = array();
}
if (isset(@=userLog[@@USER_LOGGED]) {
   @=userLog[@@USER_LOGGED]['where'] = "Finished form 3";  //change this
   @=userLog[@@USER_LOGGED]['updated'] = date("Y-m-d H:m:s"); 
}
else {
  @=userLog[@@USER_LOGGED] = array (
   "username" => @@USR_USERNAME,
   "started" => date("Y-m-d H:m:s"),
   "where" => "Finished form 3" //change this
  );
}
Then, you can query @=userLog to see where each of the users are in the parallel task.

Hello. For rental housing, there are software solu[…]

Experience heightened pleasure with Cenforce 100 M[…]

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]