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.
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
I put it in Script console and changed the project keys on same code. Did i do anything wrong here ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.