Actor Filter - set to previous task performer manager

A quick question regarding Actor filters

For example I have Staff Level 2 Lane, after it processes the task, it goes to the next swim lane (staff level 3). How can I set the actor to be the manager of the one who processed the task on Staff Level 2 lane?

Within the action filter, we do have Initiator manager, but in this case, we want it to be the task performer manager? Any advice? thanks

Hi,

You can use the user manager actor filter.
In the User Id input, retrieve the user id of the user that have executed the task in the Staff Level 2 lane:

import org.bonitasoft.engine.bpm.flownode.ActivityStates import org.bonitasoft.engine.bpm.flownode.ArchivedHumanTaskInstanceSearchDescriptor import org.bonitasoft.engine.bpm.flownode.HumanTaskInstanceSearchDescriptor import org.bonitasoft.engine.exception.BonitaException import org.bonitasoft.engine.search.SearchOptionsBuilder

def taskName = “Previous task name”
def executedTasks = apiAccessor.processAPI.searchHumanTaskInstances(new SearchOptionsBuilder(0, 1)
.filter(HumanTaskInstanceSearchDescriptor.NAME, taskName)
.filter(HumanTaskInstanceSearchDescriptor.PARENT_PROCESS_INSTANCE_ID, processInstanceId)
.filter(HumanTaskInstanceSearchDescriptor.STATE_NAME, ActivityStates.COMPLETED_STATE)
.done())
.result

if(executedTasks){
return executedTasks[0].executedBy
}

// The task may have been already archived
def archivedTasks = apiAccessor.processAPI.searchArchivedHumanTasks(new SearchOptionsBuilder(0, 1)
.filter(ArchivedHumanTaskInstanceSearchDescriptor.NAME, taskName)
.filter(ArchivedHumanTaskInstanceSearchDescriptor.PARENT_PROCESS_INSTANCE_ID, processInstanceId)
.filter(ArchivedHumanTaskInstanceSearchDescriptor.STATE_NAME, ActivityStates.COMPLETED_STATE)
.done())
.result

if(archivedTasks){
return archivedTasks[0].executedBy
}

throw new BonitaException(“No task ‘$taskName’ has been executed yet.”)

HTH
Romain

This is perfect and its all working, thank you Romain!