getting email Id from organization.xml file
Hi,
First you can get the users in a rol using the identity API and a Bonita Function available on the function section of the Groovy Editor. In the following example I'll get the email of the first 200 users of a role sorted by last name.
import org.bonitasoft.engine.identity.UserCriterion;
String role = "TheRole" //this is the role name
ArrayList<User> possibleUsers = apiAccessor.getIdentityAPI().getUsersInRole(apiAccessor.identityAPI.getRoleByName(role).id, 0, 200, UserCriterion.LAST_NAME_ASC);
ArrayList<String> usersEmail = new ArrayList<String>(); //this list will contain all the email adresses
for(User u : possibleUsers) {
usersEmail.add(BonitaUsers.getUserProfessionalContactInfo(apiAccessor,u.getId()).getEmail());
}
return usersEmail;
This is only an example, you can fit this code (or this idea) to your specific needs.
Bye, David.
I already tried this change but still the connctor fails for me.
This line does not wrk for me,
BonitaUsers.getUserProfessionalContactInfo(apiAccessor,u.getId()).getEmail()
Hi David,
Thanks for the reply.
The first stpe works for .I get the List of Users(that is the Possible Users List for the specifie role).
But the connector fails at the next step when try to get the profeesional data.
can u plz help
Thanks, Charu
Comments
Hi,
I made a mistake on the lines 6 and 9, the correct 6 is:
And the correct 9:
I've corrected my original answer.
Comments
I've made a big mistake on the line 7, this will fix it.
I was declaring the usersEmail as a ArrayList, and the Email data is a String. :P.
Well, please try it and if this does not work please attach the engine log.
PD: I've corrected the original answer.
Bye, David.