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.
By gregoakes
#790382
Hi,

I'm building a process where I want to allocate a task to the manager of a Department. In this scenario, I want a previously entered variable (MediaType) to direct which department the task should get routed to. So for example where MediaType = Audio, the task should get routed to the Audio manager. Is there a way of either:

a) routing to a Department, where it would appear in the Manager's inbox, or
b) getting the manager of a specific Department and routing to them.

The idea is that I would like to route cases to the manager of a Department so that they can reassign them to members of their Department - the opposite of the "Reports To" assignment.

I could just route it a specific user (the manager), but if I'm going to the trouble of setting Departments then it would be useful to be able to route to them.

thanks in advance
Greg
User avatar
By amosbatto
#790384
Let's say you have a process with Task1 and Task2, where Task2 uses Value Based Assignment and its variable is @@task2UserId.

In Task1, create the following trigger which is set to fire before assignment:
Code: Select all
if (!isset(@@MediaType)) {
   throw new Exception("MediaType is not defined");
}
elseif (@@MediaType == 'Audio') {
   $deptId = PMFGetUidFromText('Audio Production', 'DEPO_TITLE')[0];
}
elseif  (@@MediaType == 'Video') {
   $deptId = PMFGetUidFromText('Video Editing', 'DEPO_TITLE')[0];
}
else {
      throw new Exception("Unknown MediaType");
}
require_once 'classes/model/Department.php';
$d = new Department();
$aInfo = $d->Load($deptId);
@@task2UserId = $aInfo["DEP_MANAGER"];
Make sure that all the department managers are assigned to Task 2, or the above code will not work.
See:
http://wiki.processmaker.com/3.0/Intern ... Load.28.29
http://wiki.processmaker.com/3.1/Proces ... idFromText
http://wiki.processmaker.com/3.0/Tasks# ... Assignment

Hello amosbato, Trying to retake this conversatio[…]

Resta de valores con 2 textobox

Hola! Se replicó lo que estabas haciendo […]

Hello! If you did not find the mcrypt extension […]

Hello! You have a mistake in the url, the correct […]