· Documentation  · 3 min read

Jira Example - Bulk Clone Issues

The example shows how to use Script Master’s Script Console to clone up to 50 Jira issues from a JQL query — automating issue duplication quickly and efficiently.

The example shows how to use Script Master’s Script Console to clone up to 50 Jira issues from a JQL query — automating issue duplication quickly and efficiently.

Overview

This example demonstrates how to use Script Master’s Script Console in Jira Cloud to efficiently clone multiple issues at once using a simple Forge-based script.

With this example, Jira Administrators can run a script that takes a JQL query as input, retrieves matching issues through the Jira REST API, and automatically clones them — up to 50 issues per execution.


// You can use JQL to select Jira issues for cloning. You can clone up to 50 issues at a time

// Configuration variables
const jql = 'filter = 10001';
const cloneFields = [
  'assignee',
  'components',
  'description',
  'fixVersions',
  'issuetype',
  'labels',
  'priority',
  'project',
  'summary',
  // Other required system fields
  // Add required custom fields as well
];
const newProjectKey = ''; // leave empty to create issues in the same project
const summaryPrefix = 'Cloned - '; // leave empty to create issues without any prefix

// Script
// Search for issues using JQL https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-get, pay attention, only first 50 issues will be returned
const issuesResponse = await requestJira(`/rest/api/3/search?jql=${jql}`, {
  headers: {
    Accept: 'application/json',
  },
});
const issuesData = await issuesResponse.json();

const output = [];
for (const issue of issuesData.issues) {
  const newIssue = { fields: {} };
  for (const cloneField of cloneFields) {
    newIssue.fields[cloneField] = issue.fields[cloneField];
  }

  if (newProjectKey) newIssue.fields.project = { key: newProjectKey };
  if (summaryPrefix) newIssue.fields.summary = `${summaryPrefix}${issue.fields.summary}`;

  // Create issue https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post
  const response = await requestJira(`/rest/api/3/issue`, {
    method: 'POST',
    headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
    body: JSON.stringify(newIssue),
  });

  if (response.status === 201) {
    const clonedIssue = await response.json();
    output.push(`${issue.key} is cloned as ${clonedIssue.key}`);
  } else {
    const clonedIssueError = await response.json();
    output.push(`${issue.key} is not cloned because of ${JSON.stringify(clonedIssueError)}`);
  }
}
return output.join('\n');

How It Works

  1. Admin Input – You provide a JQL query to select the issues you want to clone.
  2. Issue Retrieval – The script uses the Jira REST API to fetch all issues matching your query.
  3. Cloning Process – Each issue is cloned into a new one, while maintaining key field values and ensuring uniqueness where required.
  4. Logging Results – The script logs the newly created issue keys for easy reference.

To maintain performance and reliability, the script limits cloning to a maximum of 50 issues per run and includes error handling to manage potential conflicts or API issues gracefully.


Why Use It

Bulk cloning is a common administrative task — especially when creating templates, migrating issue sets, or duplicating sprint backlogs.
This script automates the entire process, ensuring that it’s fast, consistent, and repeatable, without needing any external tools or Marketplace apps.


Compatibility:
This example is available in the Jira version of Script Master, within the Script Console module.

Back to Blog

Related Posts

View All Posts »
Introduction to Script Master

Introduction to Script Master

Script Master is a Forge-based app that lets Atlassian Administrators and Consultants create scripts, UI extensions, and automations directly inside Jira and Confluence Cloud — without extra infrastructure or complex setup. Build, test, and deploy customizations in one place, securely and efficiently.

Block Diagrams Documentation

Block Diagrams Documentation

Block diagrams provide a high-level visual representation of systems, processes or architectures, using blocks for key components and connectors to show relationships. Unlike standard Mermaid flowcharts that rely on automatic layout, block diagrams give authors full control over the placement of shapes for clearer, customized structure.

Exciting Updates from the Apportunity Forge Portfolio

Exciting Updates from the Apportunity Forge Portfolio

We’re excited to share important updates that make using our apps even more valuable for you. As part of the Apportunity Forge portfolio, our apps are evolving to give you a smoother, faster, and more productive experience in Jira and Confluence.