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

 

 

8 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
Manon Soubies-Camy _Modus Create_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 07, 2018

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 :)

Matt Doar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 14, 2020 • edited

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

1 vote
Gezim Shehu [Communardo]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 07, 2018

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

Gezim Shehu [Communardo]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 08, 2018

Nice :)

0 votes
Rachit Singhal
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.
Aug 14, 2023

Hi All,

 

I have figured out a way by which plugin won't be required and it can be performed using built-in functionality of automation (if using cloud).

 

Here are the steps:

 

  • Create one custom field of type text, let's say previousProject.
  • Create one automation on multiple issue events upon issue created, issue updated, issue transitioned etc. (If you are creating this automation in advanced then issue created only) and then apply the action on Edit issue fields for the above custom field to set the value of project name "{{project.name}}". This automation will capture the value of project. Make sure to apply condition for this field to be empty if choosing first option to avoid multiple run of the automation for the same purpose.
  • Add one more automation on "Issue moved" condition, select any project or particular project as per your requirement and then select action of Send email to your mail id having some required information of that issue but make sure to get the value of the custom field that we have created.
  • You can avoid the second automation if you are okay to export the issues whenever you need this value. 

 

For the above automation, you will be required to have the knowledge of smart values. You can refer to the below document for it. 

https://support.atlassian.com/cloud-automation/docs/smart-values-in-jira-automation/

 

Please let me know if anyone has any question. 

 

Thanks,

Rachit Singhal

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 # people like this

Suggest an answer

Log in or Sign up to answer