How to obtain the user or possible users in charge of performing a task?

How can I obtain the user or possible users in charge of performing the task called Step2 through a Groovy script? (See attached image) 

12qwww

I solved it in the following way:

 

List<User> possibleUsers = apiAccessor.getProcessAPI().getPossibleUsersOfHumanTask(processDefinitionId, "Step2", 0, 10)
logger.warning("possibleUsers --> " + possibleUsers)
// I get the id of the first user in the list.
def userId = possibleUser[0].id

 

It should be noted that in the process I do not have any actor filter defined.

Hello

Please refer to this link

https://community.bonitasoft.com/node/35386#node-35391

Regards