How to save the output of an actor filter into a variable?
I have a process with a lane on which I have an actor Validator
I have configured an actor filter on this lane.
I need to know who are the users that are associated to the lane because I need to send a notification to them.
In my process I need to send the notification in a service task and then after a while I have a human task.
I use something like this.
IdentityAPI identityapi = apiAccessor.getIdentityAPI();
Group group = identityapi.getGroupByPath("/acme/hr");
List users = identityapi.getUsersInGroup(group.getId(),0,100, UserCriterion.FIRST_NAME_ASC);
String emailList = "";
for(int i=0;i User user = (User)users.get(i);
ContactData contactData = identityapi.getUserContactData(user.getId(),false);
emailList += contactData.getEmail();
emailList += contactData.getEmail()+"," ;
Hi, you can execute the actor filter on a service task prior to the lane tasks but it means that:
- The actor filter do not depend on execution context
- The actor filter input is the same between all tasks
- The actor filter implementation will be coupled with the definition
Then you can use a groovy connector on a service task like this:
// Instantiate the actor filter
def filter = new UserManagerActorFilter()
// Configure the execution context
def context = new EngineExecutionContext()
context.activityInstanceId = activityInstanceId
context.processDefinitionId = processDefinitionId
context.processInstanceId = processInstanceId
context.rootProcessInstanceId = rootProcessInstanceId
def processInitiatorId = apiAccessor.processAPI.getProcessInstance(processInstanceId).getStartedBy()
// WARNING: Input parameter must match the one used later in the process
// Execute it
Obviously you should replace the
UserManagerActorFilter with the implementation you want to use anf the
Employee actor name with your Lane actor.
Hello Romain, i'm working with enrico.curiotto. I have tested your solution and it worked. Thank you for your help !!!