Script Runner change multiple user IDs

I have looked at the script runner "Renames A user ID". How do I go about doing a bulk change of user ID's? I have over 400 user IDs that I need to change.


1 answer

Here's sample. You need to just execute the script in a loop:

def ren = new com.onresolve.jira.groovy.canned.admin.RenameUser();
def input = [ 
        ["asd", "usernew"]
def result = ""
for (e in input) {
	def args = [
                   (com.onresolve.jira.groovy.canned.admin.RenameUser.FIELD_FROM_USER_ID): e[0],
        	   (com.onresolve.jira.groovy.canned.admin.RenameUser.FIELD_TO_USER_ID): e[1],
        	    (com.onresolve.jira.groovy.canned.admin.RenameUser.FIELD_MERGE): false
        result+=ren.getDescription(args, true)
        //Uncomment to actualy execute, the line above is for preview

Thanks for the response Boris. I have tried your script and also the script from this Scott Dudley from this question below

The problem I am having is that both scripts are not updating the app_user table in the database. Which is causing the erorr User 'James.Jones' exists but has no unique key mapping.

In Jira 6x you can update the user ID by editing the user in JIRA. This seems to be updating the column lower_user_name in the app_user table. When I run the scripts this is not updated and the way around it is to run these SQL statement and update the app_user table.

INSERT INTO app_user
SELECT (<id from previous query + 1>,
FROM app_user;
Not sure if there is an easy way around this since I have 400 users and I am uncertain if
adding additional users on the table app_user will cause any problems in the future.
Any information on this will be greatly appreciated.

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 ...

808 views 3 9
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