Copy components from one project to another in Jira cloud

nandhini_chandrasekar January 21, 2020

Hello,

On checking the already answered questions, I found we need to write a REST API script to copy components from one project to other - https://community.atlassian.com/t5/Jira-Core-questions/Is-there-a-way-to-copy-components-from-one-Jira-project-to/qaq-p/154879

But, we do not have any technical admins managing Jira in our organization. Is there any other simpler way to perform this activity. For now, the requirement is to copy 335 components from one project to other.

Thank you in advance. 

2 answers

1 accepted

0 votes
Answer accepted
Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 21, 2020

Hi @nandhini_chandrasekar

We've used an alternative method before. You had to be a Site Admin to do this, but it worked as required - see this link here.

To get the list of components you could either:

  • Export a list of all issues from the existing project, then cut it down to just the list of components and de-dup it.
  • Copy and paste them out of your instance and clean out the hyperlinks, etc

Ste

nandhini_chandrasekar January 21, 2020

Hi Stephen,

Thank you for your response. I will try this.

Also, Is it possible to Move Backlog items of Next Gen project to Classical Project in Bulk.?

Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 22, 2020

Hi @nandhini_chandrasekar

You can move issues between projects using the bulk issue editor - to do this:

  1. Click on the magnifying glass icon on the left-hand menu and select "Advanced search for issues"
  2. Search for the issues you wish to move across
  3. Once you have these, in the upper-right press the 3-dots options icon and select "Bulk change all X issue(s)
  4. In the next screen (Step 1), select the issues to bulk edit - the checkbox in the title row will select all - then press Next
  5. In Step 2, select Move Issues and press Next
  6. In Step 3, choose which project you're sending these issues to, then press Next
  7. A second part of Step 3 might be populating required fields in the target project or a change in status - if not, just press Next again
  8. Check the details in Step 4 and press Confirm. A loading screen will appear - wait until the move is complete and press Acknowledge.

As you're moving from Next-Gen to Classic there is sometimes some duplication (eg. having to confirm the target project multiple times for the same issue type). Just go through and select for each and it'll be fine.

Ste

nandhini_chandrasekar January 23, 2020

Hi Stephen,

Thank you. It worked.

Regards,

Nandhini Chandrasekar

0 votes
CJ Edwards July 24, 2023

Since this post is the #1 result in google for "copy components Jira Cloud" I figured I would post a script you can run in Scriptrunner for Jira cloud.

This is by no means perfect, but it will copy name, description, lead (if there is a lead)

Dont forget to get the proper Project ID!


StringBuilder output = new StringBuilder()
//copy the component TO this project
def jiraProject = "JRA"

//get list of components FROM, you will need the project ID instead of 10101
// this can be retrieved from the URL in Project/Details
def components = get('/rest/api/3/project/10101/components').asObject(List).body

//placeholder for rest results
def result

// go through each component in the list
components.each { component ->

  //check if the Lead has a value
  if (component.lead!=null){
    result = post('/rest/api/3/component')
      .header('Content-Type', 'application/json')
      .body( [
        name: component.name,
        description: component.description,
        leadAccountId: component.lead.accountId,
        project: jiraProject
      ])
    .asJson()
} else {
    result = post('/rest/api/3/component')
      .header('Content-Type', 'application/json')
      .body( [
          name: component.name,
          description: component.description,
          project: jiraProject
     ])
    .asJson()
  }
  output << component.name + " : " + result.status + ", "
}

//output for Result instead of in Logs
output.toString()

Suggest an answer

Log in or Sign up to answer