Hi Everyone,
we create users by a jelly script (soon by groovy) and in these cases we create bulk of them. It happens many times that we already have a user in our database and we create it once again. Is there a code snippet which checks whether an email address already registered in our DB and if yes, the user will not be created or JIRA warns us?
Thanks!
In Groovy you can simply use getUserByEmail
method.
import com.atlassian.crowd.embedded.api.User; import com.atlassian.jira.user.UserUtils; String emailAddress='my@address.com'; User user = UserUtils.getUserByEmail(emailAddress); if (user==null){ //create users here }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.