How to set multiple actors with specific role with groovy script?
I created a groovy script in order to get users has a specific role in a specific group.
I set the actor with groovy script
IdentityAPI identity = apiAccessor.getIdentityAPI();
final SearchOptionsBuilder builder = new SearchOptionsBuilder(0, 100);
final SearchResult userResults = apiAccessor.identityAPI.searchUsers(builder.done());
List reviewerList = new ArrayList();
The result value is like :
"value": [ 513, 521 ],
However, I got the error.
Caused by: org.bonitasoft.engine.core.filter.exception.SUserFilterExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: FLOW_NODE_INSTANCE_ID=1400397 | Declared return type class java.lang.Long is not compatible with evaluated type class java.util.ArrayList for expression userId()
... 21 more
Caused by: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: FLOW_NODE_INSTANCE_ID=1400397 | Declared return type class java.lang.Long is not compatible with evaluated type class java.util.ArrayList for expression userId()
... 24 more
I do not get the reason why.
Any help would be appreciated .
Thanks in advanced.
Is this script an Actor Filter?
It looks like a userId of type Long is expected but you're returning an ArrayList.
Are you trying to return a list of users you want to assign a task to?
If you simply want to assign an entire Group, Role or Membership to a lane, you can map them to an Actor in the Configuration menu. If you are trying to assign a specific set of individuals in one of those groups, you have to create your own custom Actor Filter Definition and Implementation.
While trying to do this myself, I discovered someone has already created a filter that returns a list of users:
You can simply import that Actor Filter .zip, and it will let you return a list of userIds in your filter script.
Thanks for the comment again.
I am going to try what you recommended. I believe that this is what I exactly want.
I will update the result.
Thanks a lot.
Thanks for the explanation. I imported the actor filter and set the actor with groovy.
It works perfectly.
I appreciate your help.:)
Thanks a lot!
I faced another issue. The user list works well. However, the task did not assign all users of the returned list. So, once each user selects the task, The message "To fill out the form, you need to take this task. This means you will be the only one able to do it. To make it available to the team again, release it. " comes out.
I need to assign the task for all users of the returned users. Do you have any idea?
Thanks in advanced.
I see that your question is not directly related to the previous one, could you please copy and paste it in a new question?
Thanks for the comment,
I created a new question.