Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

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.
#825738
Hi,

Checking on the amazing source:
https://www.pmusers.com/index.php/Manua ... _same_task

I guess that is pretty much what I need.

Instead, what if I need that the user for "Do Work" task wouldn't be selected from a dropdown but automatically assign the next user like a cyclical assignment behavior, preserving the whole logic of your original post (source) I put it above?

The idea is that the "balance" to assign task should be in a round robin assignment without letting the current user to select whom will resolve the "Do Work" task and preserving the user when comes from "More work is needed".

Thanks.

@Ed
#825741
Ed,
There are two possibilities.
Option 1:
Use rand() to select a user randomly from the list of assigned users. Over time, the number of cases assigned to each user will equal out, but there is no guarantee that the same user won't be assigned twice in a row.

In the "Create Work Plan" task, use a trigger like this:
Code: Select all
//set to the ID of the "Do Work" task:
$taskId = '4919684855c81e4eb35de18098073560'; 

$d = new Derivation();
$aAssigned = $d->getAllUsersFromAnyTask($taskId);
$randomIndex = rand(0, count($aAssigned) - 1);
@@employeeToDoWork = $aAssigned[ $randomIndex ];

Option 2:
Create a PM Table that will keep track of the last selected user and increment it to select the next one.

For example, create the PMT_LAST_ASSIGNED table with the field LAST_INDEX (int) and create one row in the table whose LAST_INDEX field is set to 0.

Then use this trigger:
Code: Select all
$aResult = executeQuery("SELECT LAST_INDEX FROM PMT_LAST_ASSIGNED");
$nextIndex = $aResult[1]['LAST_INDEX'] + 1;

//set to the ID of the "Do Work" task:
$taskId = '4919684855c81e4eb35de18098073560'; 

$d = new Derivation();
$aAssigned = $d->getAllUsersFromAnyTask($taskId);

//if index reached end of list, then start over at the beginning of the list of assigned users:
if ($nextIndex >= count($aAssigned)) {
   $nextIndex = 0; 
}

@@employeeToDoWork = $aAssigned[ $nextIndex ];

//write new last index to database:
@@ret = executeQuery("UPDATE PMT_LAST_ASSIGNED SET LAST_INDEX = $nextIndex");
populate grids with trigger

Is your question how to populate a grid with a dat[…]

You can try using this: $mssqlId = '123456789abcd[…]

Changing the login page

In your pmos.conf, try changing from: Redirec[…]

I've created two endpoints for dealing with docume[…]