Actor filter single user not working
Whoever is interested,
I found the solution. I have a process variable "uid" datatype "long'. Its passed to actor filter. So to grab the email details of userid and passed to system task email connector, just placed the codes below in groovy script.
import org.bonitasoft.engine.identity.User; import org.bonitasoft.engine.identity.ContactData; import org.bonitasoft.engine.bpm.actor.ActorCriterion;
// Get the users attached to the actor member of the human task BonitaUsers.getUserProfessionalContactInfo(apiAccessor,uid).email
Regards, Terry
Hello , My be this help you
create one data variable:uid with datatype : long (that will store single user's id)
now, in first task's form take one select box , in available value paste following code . that will give list of all available user
List<User> users = apiAccessor.getIdentityAPI().getUsers(0, 200, UserCriterion.FIRST_NAME_ASC);
Map<String,Long> combo = new HashMap<String,Long>();
for(User u:users)
{
combo.put(u.getFirstName(),u.getId());
}
return combo
now, in output operation : first filed - select that variable (uid) takes value of field - click on pencil (script) paste following
task 2 -> actor --> set actor filter -> add Uid variable
Run process , thanks kandarp
return type : should be : java.util.map
thanks kandarp
import org.bonitasoft.engine.identity.User; User user =apiAccessor.getIdentityAPI().getUserByUserName("username"); return user.getId();
Put above code in single user actor filter and you would be able to assign single user for given task.
- Akhilesh
Comments
Hi Akhilesh,
I have a process variable called "usernames" as a list with default values (user1, user2).
import org.bonitasoft.engine.identity.User;
List
for(User u:users) { list.put(u.usernames(),u.getId()); } return list
I have inserted this to actor filter, single user, groovy script but still doesnt work.
Terry
Comments
Hi Kandarp,
I followed your suggestion. However, when i run the process in the portal, I get an error "Error while getting the form page list."
The screenshot for first task's form take one select box , in available value paste following code as follow
Is the return type correct?
Regards, Terry
Hi Kandarp,
Tks. It works for actor filter. However, I have a email connector. How do i grab the email address of the selected userid ?
Terry
Hi Kandarp,
Tks. It works for actor filter. However, I have a email connector. How do i grab the email address of the selected userid ?
Terry
I have tried to grab email address of the userid with the following code but still doesnt work.
import org.bonitasoft.engine.identity.* UserWithContactData proUser = getIdentityAPI().getUserWithProfessionalDetails(user.getId()); proUser.getContactData().getEmail();
Any advise.
Terry