Display previous key of moved issue

Hi

I need to migrate several projects into one. Now I have two problems I didn't find an answer for.

1. How can I display the old key on the viewing screen of my issues?

2. Can I create a JQL query which reports me the old key in a column so we can produce reports containing the old and the new key during transition phase.

Thanks a lot
Mark

4 answers

1 accepted

This widget could not be displayed.
Henning Tietgens Community Champion Mar 14, 2013

You can also write a little script for a scripted field, provided by Script Runner plugin, to display a previous issue key.

return componentManager.changeHistoryManager.getPreviousIssueKeys(issue.id)?.join(', ')

You can use this field to display the old key in the issue view an in the issue navigator.

Henning

Great, this was what I was really looking for.

For those who are unexperienced like me this is what you need to do:

# Install Script runner plugin

# Create cusom field of "scripted field" type

# Go to plugins scripted fields and add Henning's script there

Thank you!

Perfect! Thanks Henning and Mark. This is exactly what I needed.

This widget could not be displayed.

Henning has it correct, but the API that was being used is now depreciated. So, I have updated it to use the new getAllIssueKeys method. Also if you return null, the field won't show up on non-moved tickets.

 

import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.component.ComponentAccessor;

IssueManager issueManager = ComponentAccessor.getIssueManager();
Set<String> tickets = issueManager.getAllIssueKeys(issue.id)
tickets = tickets.minus(issue.key)
if (tickets.isEmpty()) {
   return null
}
return tickets.join(', ')

Hi Dan,

I know that I am trying to trigger / open an very old Question / Answer. After implementing this in JIRA, I would like to know how to search for the values that are stored in this field using JQL.

Thanks in advance.

This widget could not be displayed.

You can see the old key in the change history tab of an issue. If you need to capture it anywhere else, you will have to implement a listener and store the value in a read only custom field.

Storing in custom field is required even to display the key in issue navigator, no matter what JQL you use.

Hi Jobin

Sounds great, but what you mean by "implement a listener"?

Thank you!

Mark

This widget could not be displayed.

Is it possible to achieve the same functionality on Jira OnDemand since it is not possible to use Script Runner??

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

79 views 1 0
Join discussion

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