Defining the allocated user by a variable at runtime

Hello,
I have tried to implement the Wokflow Resource Pattern "Deferred Distribution". The principle here is that the user to whom a task is assigned is only determined at runtime (here is the link to the description: http://www.workflowpatterns.com/patterns/resource/creation/wrp3.php).

The idea is that a user is assigned a task and fills out a form in which he enters the name of the user who will be assigned the next task. I have created a form for this and created a pool variable of a type that I previously created in the business data model. I wanted to use the Actor filter "find single User" and give it the pool variable containing the name as input/ID, so that a user should be searched for. However, the task always failed without any further error messages.

Therefore my question: Can someone tell me whether the behavior of the pattern, i.e. defining the user by a variable at runtime, is even possible in Bonitasoft Community 2023.2? And if so, what am I doing wrong or how should I implement this pattern?

Many thanks in advance.

The single user filter requires the user's ID as input, not the name.

If the user name is stored in a process variable "myUsername" use the following script for retrieving the user ID:

import org.bonitasoft.engine.api.IdentityAPI
import org.bonitasoft.engine.identity.User

IdentityAPI identityAPI = apiAccessor.getIdentityAPI();
User user = identityAPI.getUserByUserName(myUsername);
return user.getId();