Skip to content

Prevent reassignment

tomolimo edited this page Oct 7, 2020 · 6 revisions

How to use this feature

Using the GLPI_TASK_PREVENT_REASSIGN case variable (see: Case Variables) anywhere in a process, will give the possibility to prevent reassignment of any users to any tasks.

This case variable must contains a JSON string that is the representation of an array which defines a list of task UID (Process task UID) for which a list of users is given. For each task UID, when trying to reassign a user to it (see below), the users present in the list will be prevented from being reassigned to the associated task.

The users can be defined by their logon (ex: DeerJ), GLPI user id (ex: 1546) or ProcessMaker user id (ex: 929504394529df60026a040031609930)

GLPI_TASK_PREVENT_REASSIGN usage

To give an example of the case variable usage: Here is an example of a portion of code (to be used in a trigger):

@@GLPI_TASK_PREVENT_REASSIGN = json_encode([
	'6377897765dd684011a92e9086755059' => 267,
	'2337330965f7d5fb754c5c3039855644' => [268, '929504394529df60026a040031609930', 'DeerJ']
	]);

This portion of code will permit to prevent reassignment for two tasks:

  1. will prevent user with GLPI user id 267 to be reassigned to task '6377897765dd684011a92e9086755059'.
  2. will prevent user with GLPI user id 268, and user with ProcessMaker UID '929504394529df60026a040031609930', and user with logon 'DeerJ' to be reassigned to task '2337330965f7d5fb754c5c3039855644'.

Example

Let's imagine a use case where we want to achieve a process which is a request for new authorizations in an ERP for a new employee (let's call it John DEER). Then first dynaform will be the selection of the new employee and its new authorizations in the company ERP. Then the manager of the new employee must accept or reject the requested new authorizations (and eventually the associated risks). And we would like to exclude the possibility to reassign the task to the new employee, then we are going to use the @@GLPI_TASK_PREVENT_REASSIGN case variable. Then in a trigger, we will write the code:
@@GLPI_TASK_PREVENT_REASSIGN = json_encode(['6377897765dd684011a92e9086755059' => @@NEW_USER_LOGON]);
Where '6377897765dd684011a92e9086755059' is the task UID of the manager approval form, and @@NEW_USER_LOGON the case variable that contains the logon of the new employee (in this case: DeerJ).

When in the case, the manager will have to review the authorization request, it will not be possible to reassign the task to John DEER, as shown below: