How to copy components from source issue to destination when cloning via Automation rule

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

When cloning tickets using automation rule components don't get copied over as components are a project-level concept. Components are defined under each project separately, so copying them is not possible by using the standard "Copy from Trigger issue" option in the Clone issue component in the Automation rule. In this article, you will see how to use the "More Options" > "Additional fields" section to copy over components.

Solution

  1. Set any trigger(issue-related presumably) for the automation rule.

  2. Add any condition components if needed

  3. Add the "Clone Issue" component and in that go to "More Options" > "Additional fields" section.

  4. Copy and paste the below Json in the "Additional fields" box

    1 2 3 4 5 { "fields": { "components":{{triggerIssue.components.name.asJsonObject("name").asJsonArray}} } }

  5. Don't tick the "Components" field checkbox in the "Choose fields to set" option. You can choose other fields to set if needed but not Components

    Component field cannot be selected in "choose fields to set"

  6. Save and Update the rule.

This will set the components in the destination/cloned issue directly and even create the component in the destination project if it doesn't already exist.

Automation rule to set component field using JSOn

Updated on May 31, 2024

Still need help?

The Atlassian Community is here for you.