Automation For Jira - How to concatenate comments from an original issue into one comment and copy it into the cloned issue
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When cloning issues, you might want to copy over all the comments from the original issue into the cloned issues. As explained in the KB article How to copy comments from the original issue to the cloned issue, it is possible to achieve this goal by configuring a rule with Automation For Jira.
However, this solution only works for Jira Cloud, since it requires the Advance Branching functionality which is only available on Cloud, but not on Server/Data Center as per the Feature Request https://jira.atlassian.com/browse/JIRAAUTOSERVER-749.
While it is not possible to copy each comment 1 by 1 from the original issue to the clone issue, it is at least possible to concatenate all the comments from the original issue into 1 single comment, and add this comment to the cloned issue. While it is not an ideal solution, it allows to see all the comments from the original issue in the cloned issue.
The purpose of this KB article is to describe how to configure this automation rule.
Solution
For this solution, we will assume that you are trying to configure a rule that will clone an issue when it is transitioned to the "Done" status, and that will concatenate all its comments into the new issue.
Rule configuration
The rule will need to be configured as follows:
Add the Issue Transitioned trigger with the following settings
From status: Leave blank
To status: "Done" (to be replaced with the status of your choice)
Add the action Clone Issue
Add the following Branch rule
Type of related issues: Most recently created issue
Inside the Branch Rule, add the following comments:
Add the action Link issues, with the following settings
This issue: clones
Issue: Trigger issue
Add the Advanced compare condition, with the following settings:
First value:
1
{{triggerIssue.comments}}
Condition: "Does not equal"
Second value: Leave this field empty
Add the action Add comment to issue, with the following settings:
Comment: copy the full expression below:
1 2 3 4
{{#triggerIssue.comments}} Comment made by: {{author.displayName}} on {{created}} {{body}} {{/}}
Rule screenshot
Seeing the rule in action
The screenshot below shows what the original issue looks like, along with its comments:
The screenshot below shows what the cloned issue looks like, along with the comment that contents the list of comments from the original issue:
Was this helpful?