Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,366,446
Community Members
 
Community Events
168
Community Groups

View issues that have been moved from one project to another

Hi there

I would like to get an overview of how many issues have been moved from one Project to another Projects, fx. how many issues were actually created within Tech Support / Service desk project but moved to Web Development project or Sales Project etc.

 

Is this possible somehow?

 

Best regards

Kristín

 

 

7 answers

2 accepted

4 votes
Answer accepted

By default this is not possible to do via JQL Search.  ( Request dear Community members to correct me if I am wrong). Maybe via advanced search using Scriptrunner or directly running the correct query in the database you might be able to achieve the same.

But in the future if you require to search issues moved from one project to another. Create a Custom Field named " Previous Project " and use a workflow transition add-ons (JWME, ScriptRunner etc) to copy the value of Project Name/Key into the this Custom Field via a post function during issue creation.

Now even if the issue is moved, the value of the field remains the same and you can use JQL to search and find moved issues from the previous project name.

Thank you - Solved with Script Runner :)

@Kristin Bestla., I have a similar requirement, can you please share the script which worked for you to solve this.

Thanks in advance!!

Hi @Vijay Sv - I used the script from Henning Tietgens from this page:

https://community.atlassian.com/t5/Jira-questions/How-to-find-issues-that-were-moved-from-one-project-to-another/qaq-p/49115

 

Here is the script:

 

package eventim.scripts

import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.web.bean.PagerFilter

jqlQuery = 'project = BBB'
fromProject = 'AAA'
result = ''

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()

getFilterResult(jqlQuery,log).each{ Issue issue ->
oldKeys = changeHistoryManager.getPreviousIssueKeys(issue.id)
oldKeys.findAll{it==~/$fromProject.*/}.each{
// result += "$it -> ${issue.key}\n"
result += "$it,${issue.key}<br>"
}
}

return result

List<Issue> getFilterResult(String jqlSearch, log) {
def searchService = ComponentAccessor.getComponent(SearchService.class);
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
List<Issue> issues = null

def parseResult = searchService.parseQuery(user, jqlSearch);
if (parseResult.isValid()) {
def searchResult = searchService.search(user, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
issues = searchResult.issues
} else {
log.error("Invalid JQL: " + jqlSearch);
}
return issues
}

Like # people like this
4 votes
Answer accepted

Hello Kristin,

You can't do this out of the box since the WAS and CHANGED operators can be used with the Assignee, Fix Version, Priority, Reporter, Resolution and Status fields only.

If you're on Server, you can do this with JQL Tricks though:

issue in movedIssues("project","Project A","Project B") - Returns all moved issues from "Project A" to "Project B"

(see documentation)

I guess you could also do this with ScriptRunner.

Hope this helps,

- Manon

Thank you. I tried out JQL Tricks, looks like they have an error because this  query does not work "issue in movedIssues("project", "project A", "project B")". I've written to them but they did not answer.

 

So, I used script runner to solve this :)

How did you use ScriptRunner to do this? Oh I see a reply below

Like Henrique Prado likes this

Just commenting on this hoping it becomes something that could be done via JQL one day...

If the initial and destination projects use different sets of status' then one can figure what moved from project A to Project B.

E.g. if project A always uses a status = review before the issue is moved to project B, where "review" status is not used, then the following query will find all the issues in project B that have project A pedigree.

project = B and status was in (review)

This will not find issues that were created in Project B (and not moved from Project A).

I think it might be doable.

Upon moving an issue, issue key is changed and this information is saved in issue change history.

 

Now this is certainly searchable by querying the database. I think it can also be searched via Script.

issue history.JPG

Nice :)

We are running JIRA Server version. The below JLQ works for me: project = "Project A" AND issue in movedIssues("Project B")

  • "Project A" is the destination project
  • "Project B" is the original project where the issues were filed to

No need for installing Script Runner.

The functionality "issue in movedIssues" is not native in Jira

Like Michael Aglas likes this

Suggest an answer

Log in or Sign up to answer