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

Moderators: ArturoRobles, ArturoRobles

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

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
User avatar
By amosbatto
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: ... Load.28.29 ... idFromText ... Assignment

Maybe try increasing your thread stack size? Seems[…]

I use PM 3.4. Android push works while IOS push do[…]

[quote=ziadeh post_id=823031 time=1550759948 user_[…]

I have to support reports in processmaker 3.4. A s[…]