How to copy comments from the original issue to the cloned issue
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
Cloning enables you to "duplicate" a request within the same project, copying over most information from a request like the Summary and Description fields and more but not comments. Cloned requests exist as a separate entity from the original request. Their only connection is that, upon cloning, the two requests are linked — though you can unlink them at any time.
Environment
Jira Cloud / Jira Service Management Cloud
Diagnosis
Jira does not currently support copying comments from the original issue/request to the cloned one, but we do have a Feature Request for it here:
Solution
You can use smart values in the automation rule to copy the comments from the original issue/request to the cloned one whenever a cloned issue is created. You should be a project admin to create the automation rule. Please note, the following automation rule will copy both the internal and public comments to the cloned issue. This automation rule is expected to be created within the project that contains the cloned issue, otherwise the trigger may not identify via this selection criteria.
Please follow the below steps to create the automation rule:
- Under Project settings > Automation, create an automation rule with the trigger "Issue Created".
- Add the Related issues condition, and from the dropdown list select Related issues as Linked issues, Link types as Clones, and Condition as Are Present. Keep the current project in Rules restricted to projects column. This condition is to determine whether the issue that triggered the automation rule is a cloned issue or not.
- Add the Lookup issues action to search for the original issue using the JQL 'issue in linkedIssues("{{issue.key}}")' and use it for other actions by using the {{lookupIssues}} smart value.
Add the Advanced branching condition that allows you to enter a smart value, and perform actions on that value as an object. You keep the smart value as {{lookupIssues.last.comments}} and assign a variable name Comm to use it in the following automation rule action.
Under Advanced branching, add Comment on issue action to add the comments from the original issue to the cloned one using the smart values in the Comment column as below (you can change the format as per your requirement):
Comment by: {{Comm.author.displayName}} at: {{Comm.created}} {{Comm.body}}
Make sure to check the checkbox Prevent duplicates by only adding this comment once to a particular issue. In the Comment Visibility, select Internal only if you want to add the comments as internal comments, or Share with customer if you want to add them as public comments. Please note, the respective notifications will be triggered for these comments.
- Save and publish the rule.