Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By azatrath
#821844
hi all,

i have a process which is Task 4 need to be done by different Users who is claim Task 4. i choose this users in task 1 and all information need to collect in task 5. if i choose 5 users in task 1, Task 4 need to be completed 5 times by different users who i choose in Task 1.
i tried make a group from choosen users in task 1 with a grid have a dropdown columb.this is the code i collect user UID
Code: Select all
select USR_UID, CONCAT(USR_FIRSTNAME, ' ', USR_LASTNAME,' (',USR_POSITION ,' )') FROM USERS ORDER BY USR_FIRSTNAME
Each time Task 4 completed, it saves information to PM table, reset itself, goes unassigned process and user who completed task 4 once, wont see it. but i cant make it.
is this any easy way?
Attachments
Ekran Alıntısı.PNG
Ekran Alıntısı.PNG (12.63 KiB) Viewed 3412 times
User avatar
By amosbatto
#821856
You can set a trigger like the following to fire Before Assignment in Task 4:
Code: Select all
$field1 = mysql_real_escape_string(@@field1);
$field2 = mysql_real_escape_string(@@field2);
$sql = "INSERT INTO PMT_MY_TABLE (FIELD1, FIELD2) VALUES ('$field1', '$field2')";
@@result = executeQuery($sql);
//note: if you have another field which is auto increment and the primary key for the table, 
//then you don't need to include it in the INSERT. Remember that you need at least 1 primary key field.

//clear variables for the next user:
@@field1 = null;
@@field2 = null;
That should reset the variables for the next user.
By azatrath
#821861
amosbatto wrote: Thu Nov 29, 2018 11:41 pm You can set a trigger like the following to fire Before Assignment in Task 4:
Code: Select all
$field1 = mysql_real_escape_string(@@field1);
$field2 = mysql_real_escape_string(@@field2);
$sql = "INSERT INTO PMT_MY_TABLE (FIELD1, FIELD2) VALUES ('$field1', '$field2')";
@@result = executeQuery($sql);
//note: if you have another field which is auto increment and the primary key for the table, 
//then you don't need to include it in the INSERT. Remember that you need at least 1 primary key field.

//clear variables for the next user:
@@field1 = null;
@@field2 = null;
That should reset the variables for the next user.
amos ty for replying but i think you misunderstand me. i did this one already. my problem is assigned users.

how can i assign users who i chosee previous Task? it can be different count such as 4 - 10 users. each need to be completed Task 4 and they need to claim from unassigned task.
-the users is not same gorup,
-they need to be choosen in Task 1
-Task 4 need to be claim in unassigned

as a result i need to share Task 4 the choseen ones and user who completed once wont see Task 4. when each users choosen in Task 1 completed Task 4 once, process continue to Task 5
By andreaadamczyk
#821877
Hello,

I have tested it locally and could find the solution.

I made the same design as yours. In the second task, I used the "Self Service Value Based Assignment" assignment rule with the "@@group" variable.

In the first task I set the following trigger after Dynaform to set the "@@group" variable with the selected users:
Code: Select all
$checkgroup = @=checkgroupVar001;
$group = array();
for($i=0; $i < count($checkgroup); $i++)
{
	array_push($group,$checkgroup[$i]);
}
@@group = $group;
Where the "@=checkgroupVar001" variable corresponds to the checkgroup web control of the Dynaform which I use to select the users that will work on the second task.

On the second task, I used two triggers after Dynaform. The first one will remove of the list of users, the user who has already claimed the case:
Code: Select all
$group = @=group;
$user = @@USER_LOGGED;

foreach (array_keys($group, $user) as $key) {
    unset($group[$key]);
}
@=group = $group;
And the second one will verify if all of the users selected have claimed the unassigned case to route to the third task:
Code: Select all
$users = @=group;
$appuid = @@APPLICATION;
$c = 0;

for($i=0; $i < count($users); $i++)
{
	$query = "select * from LIST_PARTICIPATED_LAST where APP_UID = '$appuid' AND USR_UID = '$users[$i]' and TAS_UID='XXXXXXXXXXXXXXXXXX'";
	$result = executeQuery($query);
	if(count($result)!= 0)
	{
		$c += 1;
	}
}

if($c == count($users) || count($users) == 0)
{
	@@result = 1;
}
else
{
	@@result = 0;
}
Where 'XXXXXXXXXXXXXXXXXX' is the task UID of the second task.

And finally, in the gateway condition, if the @@result == 1 the case will be derivated to the last task, otherwise it will return to the second task.

I hope this helps you.

Please, let me know if you have any doubt.

Regards.
By azatrath
#821893
andreaadamczyk wrote: Fri Nov 30, 2018 11:14 am Hello,

I have tested it locally and could find the solution.

I made the same design as yours. In the second task, I used the "Self Service Value Based Assignment" assignment rule with the "@@group" variable.

In the first task I set the following trigger after Dynaform to set the "@@group" variable with the selected users:
Code: Select all
$checkgroup = @=checkgroupVar001;
$group = array();
for($i=0; $i < count($checkgroup); $i++)
{
	array_push($group,$checkgroup[$i]);
}
@@group = $group;
Where the "@=checkgroupVar001" variable corresponds to the checkgroup web control of the Dynaform which I use to select the users that will work on the second task.

On the second task, I used two triggers after Dynaform. The first one will remove of the list of users, the user who has already claimed the case:
Code: Select all
$group = @=group;
$user = @@USER_LOGGED;

foreach (array_keys($group, $user) as $key) {
    unset($group[$key]);
}
@=group = $group;
And the second one will verify if all of the users selected have claimed the unassigned case to route to the third task:
Code: Select all
$users = @=group;
$appuid = @@APPLICATION;
$c = 0;

for($i=0; $i < count($users); $i++)
{
	$query = "select * from LIST_PARTICIPATED_LAST where APP_UID = '$appuid' AND USR_UID = '$users[$i]' and TAS_UID='XXXXXXXXXXXXXXXXXX'";
	$result = executeQuery($query);
	if(count($result)!= 0)
	{
		$c += 1;
	}
}

if($c == count($users) || count($users) == 0)
{
	@@result = 1;
}
else
{
	@@result = 0;
}
Where 'XXXXXXXXXXXXXXXXXX' is the task UID of the second task.

And finally, in the gateway condition, if the @@result == 1 the case will be derivated to the last task, otherwise it will return to the second task.

I hope this helps you.

Please, let me know if you have any doubt.

Regards.
ty Andrea for response.

i did what you told me but after task-2 triggers not working well,
After 1st trigger :
task-1.PNG
task-1.PNG (36.63 KiB) Viewed 3368 times
Before task-2 triggers :
task-2 start.PNG
task-2 start.PNG (39.84 KiB) Viewed 3368 times
after task-2 triggers :
task-2 after trigger.PNG
task-2 after trigger.PNG (16.86 KiB) Viewed 3368 times
and it goes directly to last step. btw how can be possible Application ID deleted?
can i handle grid and dropdown instead of checkboxes?
By andreaadamczyk
#821912
Hello,

Both triggers have to be set After Dynaform on the second task. I've attached the process so you can see what exactly I did: "SameTaskDifferentUsers-1.pmx"

By the way, you can use grids or dropdowns instead of checkboxes, but if you use dropdown you could only select an item from the list.

Please, let me know how it goes.

Regards.
Attachments
(53.74 KiB) Downloaded 231 times

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]