There is nothing in the solution that will cause a different behavior on runtime server. Can you please ensure that there are members (users) in the Team/Group that the task gets assigned to, before the zero-timer code reassigns it to a specific user?
Original Message:
Sent: Tue March 26, 2024 07:55 AM
From: Mansour SOW
Subject: BAW 21.0.3: reassign task to another user
Hello Katre,
thank you for your suggestions, now it works in development environment.
But when I create a snapshot and deploy it in a stagging environment, I still have the same problem (see attached screenshot).
------------------------------
Mansour SOW
BPM Technical Lead
Original Message:
Sent: Thu March 21, 2024 07:31 PM
From: Ajay Katre
Subject: BAW 21.0.3: reassign task to another user
Hi Mansour,
Thank you for attaching the screenshot. The timer implementation seems to have a problem. When implemented as necessary for this logic to work, the timer will be attached to the activity as a "Boundary Event", and it will not interrupt the activity. One can tell whether that is case or not by looking at the peripheral line around the timer event. In the screenshot above: either the timer isn't attached to the activity at all, or the 'Interrupt activity' checkbox is still checked (this is default behavior).
The first thing happens, depending upon where you drop the timer. Sometimes in WebPD it doesn't attach to the activity. You can know for sure by clicking on the timer after attaching it then ensuring the General tab reads: "Boundary Event." If it reads "Intermediate Event," then delete and reattach a new timer to the activity.
If the timer is correctly attached as a boundary event, then the "Interrupt activity" checkbox is not deselected/unchecked. Once you do so, the circle around the timer event will show a single dotted-line. Your screenshot shows a solid double-line. Please refer to attached screenshot.
A couple of other things that I noticed but are not related to the problem you are trying to solve:
(a) The reassign server script is then routed to the activity 'A traitement apres un retou..." above it. Meaning that activity will always start right after the timer-based server script execution completes. Is this really what you want? If not, then please flow the 'Tache de script' to an 'End' event.
(b) There is no out flow from your activity 'Soumission des document par..." that you want to assign to the designated person/user.
All the best!
------------------------------
Ajay Katre
Salient Process
Original Message:
Sent: Thu March 21, 2024 07:37 AM
From: Mansour SOW
Subject: BAW 21.0.3: reassign task to another user
Dear Katre,
Thank you for yours tips.
I tried it but the task isn't assigned to my user and goes directly to the last task(see attached picture)
------------------------------
Mansour SOW
BPM Technical LeadMansour SOW
BPM Technical Lead
Original Message:
Sent: Fri March 15, 2024 01:20 PM
From: Ajay Katre
Subject: BAW 21.0.3: reassign task to another user
Hi Mansour,
If I understand correctly, you want to assign the task to a specific person when the task is first generated. While providing the ability for a manager ("super-role") to reassign the task to other users from a group of users.
The issue with your implementation is well explained by Jens. There is a round-about way to achieve this:
1. Attach a zero-minute timer to the task.
2. In the task assignment select the team of all the users that the manager should be able to reassign the task to. You can also use custom assignment and specify a group of users (using ROLE:<group_name>
or TEAM:<team_name>
syntax that to what you had for the user).
3. On the zero-minute timer's Pre-Assignment, set a taskId variable to the value of tw.system.step.task.id
4. Place a server-side script on the flow line of that zero-minute timer. Inside this script, reassign the task to the specific user that will be the default/first person to work on the task. Like so:
var task = tw.system.findTaskByID(tw.local.taskId);
task.reassignTo(<user_name>);
5. If there isn't a guarantee that the system has the user that you are reassigning the task to, then it will be a good idea to lookup the user and passing the TWUser only after finding it to the reassignTo call.
var task = tw.system.findTaskByID(tw.local.taskId);
var user = tw.system.org.findUserByName(<user_name>);
if (!!user) {
task.reassignTo(user); // Accepts TWUser, user_name, role, team, etc.
} else {
// Add custom exception handling here
log.info("Cannot assign task <task_name> to user <user_name>. User not found.");
}
Hope that helps!
------------------------------
Ajay Katre
Salient Process
Original Message:
Sent: Tue March 12, 2024 09:19 AM
From: Jens Engelke
Subject: BAW 21.0.3: reassign task to another user
Hi Mansour,
this dialog is showing all users who could claim the task, except for the current user who has claimed it already.
As you assigned this task to one exact user, there is noone else to show here
Which set of users would you expect to appear? From an authorization perspective, this task owner is not allowed to assign it to a user who has not been previously authorized.
See https://www.ibm.com/docs/en/baw/23.x?topic=calls-rest-api-authorization-task-actions and search for "Assign a task to a user (PUT)"
"Task owner can reassign to potential owners"
------------------------------
Jens Engelke
Original Message:
Sent: Tue March 12, 2024 06:49 AM
From: Mansour SOW
Subject: BAW 21.0.3: reassign task to another user
Dear Jens,
Thank you for you suggestion but I want to task assignment not using admin console.
I want to manage it by a super role(attached capture)
------------------------------
Mansour SOW
BPM Technical Lead
Original Message:
Sent: Mon March 11, 2024 04:29 AM
From: Jens Engelke
Subject: BAW 21.0.3: reassign task to another user
There is no way to assign tasks to a session id. USER:<user-id> (the login name) is likely what you are referring to.
For re-assign, there is a REST API that can be invoked by process app admins and system admins to reassign tasks even outside the team that was originally assigned. Your way of "custom assignment" likely omits an assigned team, therefore this "powerful" reassign is required.
------------------------------
Jens Engelke
Original Message:
Sent: Fri March 08, 2024 05:01 AM
From: Mansour SOW
Subject: BAW 21.0.3: reassign task to another user
How to reassign a task to another user after assign it using USER:<user_name> where user_name is a session id ?
Need your support.
------------------------------
Mansour SOW
BPM Technical Lead
------------------------------