We move issues between projects. Is there a query to find all the keys an issue might have had in its lifetime?

Is it possible to find all the issuekeys an issue might have had in its lifetime?

3 answers

This widget could not be displayed.

Install the Script Runner Plugin.

Create a scripted custom field e.g. "Previous Jira Key/s"

Add the following script to the field:

import com.atlassian.jira.ComponentManager
 
def componentManager = ComponentManager.getInstance()
def changeHistoryManager = componentManager.getChangeHistoryManager()
x = changeHistoryManager.getPreviousIssueKeys(issue.id)
if (x.join(' ') == "") {
   return null
}

return x.join(' ')

Make sure the settings for the field are:

Template: Free Text Field (unlimited text)
Configured searcher: Free Text Searcher

Add the field to the view screen for the issue if you want it to appear when you view the issue.

Add it to the Issue Navigator to have it display in search results.


Hi Cyril,

Which version of JIRA does this code work?

Regards,

Rathna

This widget could not be displayed.

movedIssues() in JQL Tricks Plugin function will do what you are expecting, check this

https://marketplace.atlassian.com/plugins/com.j-tricks.jql-plugin

This widget could not be displayed.

Sean,

It is possible to do that through the database running the following query:

SELECT 	ci.oldstring AS "Old Key", ci.newstring AS "New Key", cg.author, cg.created FROM changeitem ci 
	JOIN changegroup cg ON ci.groupid = cg.id 
	JOIN jiraissue ji ON cg.issueid = ji.id
	WHERE ci.field = 'Key' AND ji.pkey = '<issue-key>';

Just replace '<issue-key>' with the current Key of the issue.

I hope this helps! :)

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 Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

576 views 25 15
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