Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to edit Jira's entities.xml to modify user names prior to a restore?

Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2021

I would like to perform a full restore in Jira BUT the usernames need to changed from full email addresses to only the username portion of the email address.

For example, johndoe@mycompany.com would become johndoe

I see in entities.xml there are lines beginning with <User id= that contain userName and lowerUserName keys, but user name (and user key) seem to appear all over the file.

Is it possible to do what I've described above, and if so... how?

1 answer

0 votes
Thomas Deiler
Community Champion
October 15, 2021

Dear @Rob Horan ,

yes, you can do - you need to replace the old username in some other places. Be aware not to change the emailAddress.

I have done this in the past for a larger project where 2 Jira instances got merged. Beside usernames, I also had to change issue types, statuses, custom fields, resolutions and link types. It worked like a charm, once you understand the logic in the XML file.

Anyhow, when restoring the dump in a sandbox environment, you will see if it works or not.

So long

Thomas

Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2021

So, just to be clear, I can run a replace on:

  • userName
  • lowerUserName

and this would be OK?

Thomas Deiler
Community Champion
October 15, 2021

Better, before the entire replace, check manually a couple of XML elements that references the 'username' and not the ID. Then you are save.

In Jira's XML backup file the 'username' is used in other places. Eg. for the entity "project" and its property "lead", there you will find the 'username' and not it's id.

Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 15, 2021

Well,that's why I'm asking for help.i appreciate the advice, don't get me wrong, but I was hoping for a definitive set of patterns to use for search and replace.

I'm somewhat surprised this hasn't been documented on the community yet.

Thomas Deiler
Community Champion
October 18, 2021

Dear @Rob Horan ,

the reason for that there is no 'official' documentation is the risk that you break your system or it get's unstable when the modifications of the XML are not successful.

Therefore it is very important to perform a dry-run before doing this for a production environment.

To better understand the XML file format (no fear - its no rocket science), I recommend to create a new empty instance, create 5 users, a couple of issues with comments and attachments and modify them with those 5 users. Then export to XML and change the username of one user and restore. This should take you not too long, but you will know where the pitfalls are.

So long

Thomas

Rob Horan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 18, 2021

Well, I don't mean docs from Atlassian :)  But I figured someone in the community would have documented it.

If I get to do this I'll see if I can place a comprehensive reply here as a reference to others.

Like Thomas Deiler likes this
Thomas Deiler
Community Champion
October 18, 2021

Great! Please write an article afterwards, to share your xp and link it with this question.

Suggest an answer

Log in or Sign up to answer