Creating multiple issues from filter results


I often need to create similar tickets which are based on a query result.


  • A filter returns 20 issues.
  • For each of these issues I need to create another issue in another project.
  • Each of the newly created issue should take the original issues' key and summary and prepend some text for the summary.
  • Original ticket
    • Key: MYKEY-45
    • Summary: Installation of release 1.2
  • New ticket:
    • Summary: Test MYKEY45 - Installation of release 1.2


Is there an existing plugin for such a task?

2 answers

Hi Robert,

If you are willing to user a 3rd party plugin, what you are asking is doable using ScriptRunner for JIRA (link to documentation) There is also a free version 3.1.4 - which is only available for JIRA v6 (check version history). So what you could do with the tool is to navigate to script console and run the script below.

import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.issue.IssueInputParametersImpl
import com.atlassian.jira.project.Project
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.web.bean.PagerFilter

def jqlSearch = """
project = "Source Project"

def issueManager = ComponentAccessor.getIssueManager()
def searchService = ComponentAccessor.getComponent(SearchService)
def targetProject = ComponentAccessor.getProjectManager().getProjectObjByKey(PROJECT_KEY_TO_COPY_TO)
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issues = []

SearchService.ParseResult parseResult =  searchService.parseQuery(user, jqlSearch)
if (parseResult.isValid()) {
    def searchResult =, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
    issues = searchResult.issues.collect { issueManager.getIssueObject( }

//iterate through the issues returned from the JQL and create clone issues to project with key PROJECT_KEY_TO_COPY_TO
issues.each { it ->
    createIssue(targetProject, it, user)

 * A function to create the target issue based on target project and properties extracted by the source issue.
 * You can build the target issue in the way you want (issueType, assignee, reporter, customFields etc..)
 * but for the example, for the mandatory fields (issueType, project) and for the highly recommended
 * (reporter, priority) we copy the source issue's ones
 * @param targetProject A target Project with key PROJECT_KEY_TO_COPY_TO
 * @param sourceIssue The source issue where from the summary (and any other properties) will be copied
def createIssue(Project targetProject, Issue sourceIssue, ApplicationUser user) {
    def issueService = ComponentAccessor.getIssueService()

    // build the target issue's summary
    def targetIssueSummary = "Test ${sourceIssue.key} - ${sourceIssue.summary}"

    IssueInputParameters issueInputParameters = new IssueInputParametersImpl()
        .setProjectId( //use the mandatory target project id
        .setSummary(targetIssueSummary)//use the mandatory issue summary
        .setIssueTypeId(sourceIssue.issueTypeId) //use the mandatory source issue's issueType (make sure that the target project has this issue type configured)
        .setReporterId(sourceIssue.reporterId) //use the source issue's reporter
        .setPriorityId( //use the source issue's priority
        //set any other fields you wish for the new issue

    IssueService.CreateValidationResult createValidationResult = issueService.validateCreate(user, issueInputParameters)
    if (createValidationResult.isValid()) {
        def targetIssue = issueService.create(user, createValidationResult).issue
        log.debug "Target issue ${targetIssue.key} created with summary ${targetIssue.summary}"

The sciprt above is tested in a JIRA v7 instance, if you need it tfor a JIRA v6 then there should be a couple of trivial changes

regards, Thanos

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 09, 2018 in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

375 views 6 0
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