Is it possible to create new JIRA users with Groovy

Hello Atlassian forum members,

Is it possible to add new users to JIRA using Groovy?  I have looked through the UserManager and ApplicationUser but could not find anything related to new user creation.  If anyone has experience with this and could assist, or could point me to the documentation should I have simply missed it I would appreciate it.

Thanks, and I hope this finds everyone doing well.




2 answers

Or if you decide to use Script Runner (and for JIRA v7.*) you can execute the script below to your script console

import com.atlassian.jira.bc.user.UserService
import com.atlassian.jira.component.ComponentAccessor

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def userService = ComponentAccessor.getComponent(UserService)

UserService.CreateUserRequest createUserRequest = UserService.CreateUserRequest.
        withUserDetails(user, "username", "password", "", "Test User: user")
UserService.CreateUserValidationResult result = userService.validateCreateUser(createUserRequest)

For JIRA v6.*

import com.atlassian.jira.bc.user.UserService
import com.atlassian.jira.component.ComponentAccessor

def user = ComponentAccessor.getJiraAuthenticationContext().getUser()
def userService = ComponentAccessor.getComponent(UserService)

UserService.CreateUserValidationResult createUserValidationResult =
                "User Full Name")

if(createUserValidationResult.isValid()) {
    def newUser = userService.createUserWithNotification(createUserValidationResult)
    return "User ${newUser.displayName} succesfully created"
} else

There are several methods you can call and create users with different rights see the UserService API, for example if you want a user with admin rights use 


and if you do not want to receive "user created" notifications use



Two options always better than one....

I edited the params to make them more clear.

Kind regards



could you please provide the example in other format.

Hi, I improved the script above, let me know if this works for you. And if not please provide the error you get, if any, in the logs.

hi thanos,

Thanks .its working fine now ...

Great !!! I am looking answer for the past two days .i am searching for the groovy tutorials .But no luck ...

Good Job Thanos .

Hi thanos,

i need a help from you ... i need to create a custom field with multi level cascading select . do u know about that .

i need to create 2 levels ,3 levels and 4 levels and also need to insert the n number of values in to that custom field  at the time of the creation itself . it is possible in JIRA jelly runner . but in groovy i am not aware the process and the coding part too.

can you help on this ?



Could you please create a new question, because is different than the original one, and I am sure someone (or even me when I find some time) will answer.


Hi thanos,

already i created a new question in this blog .


check this questions:


Hello Thanos,

Thank you very much for your answer.  We are still running JIRA 6.4.11 (something I should have stated in my question, apologies) but perhaps your suggestion can still work in the older API with some modification.  I appreciate you taking the time to provide your thoughts, thank you again.



Hi Scott

Apologies for the confusion, I thought rTrack Support was you and I modified the original script to be compatible with JIRA7 (the original one was comp with JIRA 6.4), I will repost the JIRA6 compatible one. 


Any confusion was my fault, not your smile  I appreciate any help you are willing to provide, and thanks again!

I added in the answer a script compatible with JIRA v6.* Please let me know if this works for you.


addUser and related actions are available in the JIRA Command Line Interface (CLI) and can be used in almost any scripting language.

I have seen some of the Bob Swift tools and they look quite powerful.  Perhaps in the future we will have a chance to work with them.  Thank you for your suggestion!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,193 views 5 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you