
Jira provides powerful workflow automation capabilities, allowing users to streamline repetitive tasks without the need for coding. In this blog, we will explore how to clone an issue from one project to another using a script without writing any code.
Understanding the Requirement
Many organizations have projects in Jira dedicated to handling intake requests. Sometimes, due to specific business needs, they require certain issues to be cloned into another project. For instance:
- You have a project that collects various tickets, but certain issues need to be transferred to a development project.
- You want to copy selected fields like Summary, Description, Priority, and Affected Version from one project to another automatically.
Using Jira’s built-in post functions, this can be accomplished easily without custom scripts.
Configuring the Workflow for Cloning Issues
Step 1: Access the Workflow
- Navigate to the Project Settings of your source project.
- Click on Workflows and locate the workflow associated with your project.
- Open the Create Issue transition.
Step 2: Add a Post Function
- In the transition settings, go to the Post Functions section.
- Click Add a new post function and select Clone an Issue and Link (available via ScriptRunner or other automation tools).
- Configure the clone settings:
- Choose the target project (e.g., from "Demo" to "Dev").
- Select the fields to copy, such as Summary, Description, Priority, and Affected Version.
- Define the issue type in the target project.
- Set the link type (e.g., "Clones" or "Is Cloned By").
- Ensure the post function is executed at the right sequence in the workflow.
Step 3: Publish and Test
Once the workflow is updated, test the automation:
- Create a new issue in the Demo project.
- Verify that a corresponding issue is cloned in the Dev project with the correct fields.
- Check if the link between the original and cloned issue is established.
Handling Version-Specific Fields
If the Affected Version field is project-specific, ensure that the versions exist in the target project. If the version is missing, it may not be copied correctly.
To resolve this:
- Create the required versions manually in the target project.
- Ensure that affected versions are mapped correctly during cloning.
Conclusion
Using Jira’s workflow automation capabilities, cloning issues across projects can be done seamlessly without writing any code. By setting up post functions in the workflow, teams can efficiently manage issue tracking and ensure better collaboration across projects.