Forums

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

Track the tickets moved from one project to other project.

Lakshmi
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.
March 30, 2020

Hi Team,

 How we can track the tickets moved from one project to another using JQL query ? Is there any option with Scriptrunner ?

Could you please help me on this.

2 answers

1 accepted

1 vote
Answer accepted
Ravi Sagar _Sparxsys_
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.
March 30, 2020

Hi @Lakshmi S 

You can look into the history of the issues using ScriptRunner. Look for the change in Key.

This page has a script.

Ravi

Lakshmi
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.
March 30, 2020

Hi @Ravi Sagar _Sparxsys_ ,

 I put it in Script console and changed the project keys on same code.  Did i do anything wrong here ?

code.PNG

Leonard Chew
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.
March 30, 2020

@Lakshmi S  That is the old script for previous jira versions. For Jira 8, read the comments to the end and you'll get to this:

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

def jqlQuery = 'project = TEC'
def fromProject = 'LCH'
def result = ''

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()

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

return result

List<Issue> getFilterResult(String jqlSearch) {
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.warn('Invalid JQL: ' + jqlSearch)
}
return issues
}
1 vote
Jack Nolddor _Sweet Bananas_
Atlassian Partner
March 30, 2020 edited

Hi Lakshmi_S and Welcome,

Sadly there is not a built-in scripted JQL on Script Runner for Jira to achieve the desired search, you must develop you own as @Ravi Sagar _Sparxsys_ already suggested.

 

As an alternative you can also use a third-party app to enhance your searching. Using i.e. JQL Booster Pack you can type the following:

 

Find issues moved from EMEA project to LATAM project ,  i.e.:

issue IN movedIssues("EMEA", "LATAM")

Note that this is just an exaple, you must tune your query to fit your needs

References:

 

Hope this helps you to create awesome queries <3

Kind regards

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events