Copy comments while cloning the Issue in Jira cloud

Tushar.Kamble October 6, 2019

Can we copy comments while cloning the Jira issue in cloud

7 answers

2 votes
Patrick Seamars November 1, 2022

You can create an automation that is triggered on issue link > then look for {{destinationIssue.comments}} (this looks for the issue that yours is cloned from) > use an advanced branch to iterate over each comment and >  then add the comments one-by-one to the cloned issue. 

I used these articles to help me get here: 
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/

https://community.atlassian.com/t5/Automation-articles/Branching-over-smart-values-in-Jira-Automation/ba-p/1741935

 

Screen Shot 2022-11-01 at 4.12.42 PM.png

Screen Shot 2022-11-01 at 4.13.05 PM.png

Screen Shot 2022-11-01 at 4.13.19 PM.pngScreen Shot 2022-11-01 at 4.13.30 PM.png

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2022

The branching shown in this example collects the comments from the destination issue and then adds those comments to the destination issue.

How would you copy the comments from the source issue to the destination issue?

Patrick Seamars November 17, 2022

I believe the naming of that is counter-intuitive. It actually takes from the source issue and copies to the new, cloned, issue. It confused me as well, but it does what I want it to. 

Like Gary Spross likes this
Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2022

Ok, I must have something setup incorrectly then because it's currently not working to copy the comments from the source issue to the new cloned issue.

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2022

I've gone through the rule several times and I'm not getting it to work properly.

The rule triggers based on a "clone" link type being established.

Within the rule, the source issue is the issue that was used to do the cloning.

The destination issues is the issue that was cloned.

The Advanced branching is collecting the comments from the destination issue. In this case, that issue would not have any comments (since the clone just occurred and comments aren't copied over, which is the entire point of creating this automation rule).

The rule then adds comments to the issue, "the issue" being the source issue (aka the issue that was used to do the cloning). Since the destination issue (aka the issue that was cloned) has no comments, nothing happens.

Unless I'm completely missing something, I'm not really sure what this rule is doing for you that is solving anything.

I need the rule to copy the comments from the issue that was used to do the cloning to the issue that was cloned. If I could specify which issue to "Add comment" to, that would solve the issue I'm having.

Patrick Seamars November 17, 2022

I believe the destination issue in this case is the original issue that was being cloned from because the issue triggering the automation is the cloned issue. 

 

I just ran through the use case again to check my own sanity and it's working as I understand you're expecting it to. 

 

Add comment to original issue:

 

Screenshot 2022-11-17 at 12.33.46 PM.png

 

 

Clone issue: 

Screenshot 2022-11-17 at 12.34.58 PM.png

 

Look at Cloned issue and see the magic: 

Screenshot 2022-11-17 at 12.35.14 PM.png

Like Gary Spross likes this
Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2022

Thanks for the response Patrick!

The cloning I'm doing is occurring within another automation rule, based on the transition of the issue.

Within the automation rule to copy the comments, the source issue is the original issue (SUP) and the destination issue is the cloned issue (AE).

Screenshot 2022-11-17 154419.jpg

So, that seems to be my problem, because when adding the comment, the logic wants to do it against the source issue. I have no way to tell it to add the comment to the destination issue.

If I could either flip the issue scope of the rule or add the comment to a specific issue, then it would probably work.

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 17, 2022

Yeah, that is the problem. I just confirmed it by cloning an issue manually. When cloned manually, the source issue is the newly cloned issue and the destination issue is the issue that was cloned from. When cloning occurs from within my automation rule, the subsequent automation rule gets the issues reversed.

I looked into my automation rule that is cloning the issues and I set up the link type backwards... Corrected this and now it's working as expected.

Sorry for so much back and forth, but thank you for going on this journey with me!

Like Patrick Seamars likes this
Patrick Seamars November 17, 2022

Awesome! Glad it worked out! Happy to help! 

Like # people like this
Deleted user February 22, 2023

Gary, can you pls show on screen short what you've changed ("I set up link type backwards")? I have the same problem:(

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2023

I am cloning the issues through automation. Within the action to clone the issue, I was setting the link type to "is cloned by". However, when an issue is cloned within Jira, the cloned issue is linked to the other with the "clones" link type. I had to switch the link type to "clones" in my automation rule action so that the other automation (to clone comments) would work properly.

Like Deleted user likes this
Wally Brabec February 22, 2023

I think this entire thing is great however i cannot get it to work either.  i am also triggering the automation from another automation and i cannot get the rule past the following.

Capture.PNG

doesnt matter if i use clones or cloned by

Capture.PNG

CON-18 clones ART-37

ART-37 is cloned by CON-18

 

suggestions?

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2023

@Wally Brabec

Your issues "CON-18" links to "ART-37" using the "clones" link type?

Like this:

Screenshot 2023-02-22 131932.jpg

Can you send a screen capture showing the link on "CON-18"?

Based on the automation audit log message of: "The following issues did not match the condition: CON-18", it doesn't seem like the automation rule is seeing this as the case.

Wally Brabec February 23, 2023

doing lots of testing so ART-37 have changed to ART-60 (2nd image).  got through some of my issues however the largest issue is what i think others are experienceing.  i need to take all the comments from CON-18 and populate ART-## however the process always goes to CON-18 for the update.  i did get the rule to fire using "clones".  if i use the smart value of {{Issue.comment}} then CON-18 duplicates all comments.  if I use a smart value of {{destinationIssue.comments}} nothing updates.  To reitterate what i said above i cant figure out a way to update ART-## with all the comments from CON-18 (i am using the workaround suggested by Jesse and even thought it works i would prefer to have each comment separate instead of in one large comment.

Thanks for any help in advance

Audit.PNG

 

Capture.PNG

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2023

Let's try this...

Here's screenshots of my 2 automation rules.

This is the automation that clones the issue. You can see the clone type being used is "clones" and it points to the issue that triggered the automation rule to run.

Clone Issue.jpg

These screenshots are each step of the automation that copies the comments to the issue that was cloned.

Note: The "Check to allow other rule actions to trigger this rule. Only enable this if you need this rule to execute in response to another rule." checkbox is checked.

Rule triggers when a link type of "cloners" is established.

Copy Comments 1.jpg

A check ensures that the issue this rule is running against has a link to an issue using the "clones" link type.

Copy Comments 2.jpg

A branch rule is added to cycle through the comments from the "destination" issue.

Copy Comments 3.jpg

The add comment action adds each comment from the "destination" issue to the "trigger" issue (with some additional data for clarity).

Copy Comments 4.jpg

 

Hopefully this helps you to compare the configuration of your automation rules.

Wally Brabec February 23, 2023

Thanks Gary.  the funny thing is my rules were exactly like yours with 2 exceptions (1 was the value compare.  which i did not use) and 2 your automation is a global rule where since i was testing i kept the rule to just the project i was using.  i changed the role to a global rule and it worked great and then i started to think that i only had it setup for 1 project, not the project that i was cloning the issue to.  i move it from a global rule to the 2 project and it still worked like a champ.  sometimes we just cant get out of our own ways.  i really appreciate the help and its perfect now.

Like Gary Spross likes this
Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2023

Awesome! So glad you got it working. There's so many little caveats (single project vs multi project vs global) that are "got ya's" for me all the time. That's why I figured just sharing screen captures of the rules I had for you to use as a comparison would be helpful.

Alexandra Astor March 10, 2023

Hi!  I am having the strangest issue.  I was able to follow the steps above and a comment is now populating in the cloned issue.  However, the smart vales aren't pulling over the comment.

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 13, 2023

@Alexandra Astor, I'm not sure what you are saying your issue is. You said the comment is populating in the cloned issue, but the smart values aren't pulling over the comment. What do you mean by "the smart values aren't pulling over the comment"?

Alexandra Astor March 17, 2023

Hi Gary - The automation is creating a comment in the cloned issue but it only has the static text from the automation rule.  It is not pulling in anything from the smart values.  Here are some screenshots:

Capture2.PNGCapture1.PNG

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 17, 2023

Your named the smart value: OriginalIssueComments, but then, when adding the comment, you referenced the smart value as: DestinationIssueComments. Change the smart value reference to OriginalIssueComments and it should work.

Alexandra Astor March 17, 2023

Still no luck unfortunately.

Capture2.PNGCapture1.PNG

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 17, 2023

Send a screen capture of the component that is creating the smart value. I'm guessing the smart value you're specifying is incorrect. It should be: "{{destinationissue.comments}}".

Alexandra Astor March 20, 2023

Here it is:Capture.PNG

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2023

Dumb question... Are there comments to copy from the issue?

You can add a log showing the # of comments:

# of comments: {{destinationissue.comments.size}}

I added a check in my rule to only proceed if there are comments to copy.

Screenshot 2023-03-20 141910.png

 

If there are comments, then maybe try adding a log to just capture the comments to see if it's something to do with the smart value you're specifying.

Alexandra Astor March 20, 2023

I haven't used this type of condition for automation before.  I think I added it correctly?

Capture.PNG

Here's the audit log:

Capture1.PNG

Any chance that helps?

Alexandra Astor March 20, 2023

oh and to answer your question, yes there are comments.  Not a dumb question, I've double checked several times.

Capture3.PNG

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2023
  1. The "Advanced Compare" action should be prior to the "Smart Values" branch.
  2. I don't see anything wrong with the configuration of your rule, so the only thing I can think is that the link is backwards.
    1. Which ticket has the comments you want to copy?
    2. Based on the audit log, you are attempting to copy the comments from the ITS ticket to the ATLAS ticket
    3. Is this correct?
    4. If it's supposed to be the other way around, as a test, update the "If: Linked issues present" condition to "is cloned by" and see if that works
    5. If this works now, then change this rule back and in your other automation, to clone the issue, change the link type being applied to "clones" instead of "is cloned by"
Justin Gong October 5, 2023

@Gary Spross 

Hi Gary, thanks for your screenshots, I think it's a lot easier to understand than the another documentation I was working with. I was wondering if you could help with an issue I've encountered: the comments are not copied in the order of dates when the comments were made.  

I was successfully able to copy all of the "is cloned by" ticket's comments to "clones" ticket, but the comments are all out of order. Is there a way to copy the comments from the oldest to newest? 

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 5, 2023

I was having the same issue, so I ended up combining all of the comments to be copied into a single comment. See the comments below from @Jesse Kona and my follow up.

Like # people like this
Isaac Savage December 11, 2023

@Gary Spross Thanks for sharing those screenshots. The "Global" adjustment fixed me right up.

I'm wondering how to attach an Automation that deletes the original Issue after copying over the comments.

I currently have two Automations set up.

  1. Clone the Issue
  2. Copy comments to new issue
  3. How to delete original Issue?

Any suggestions for me in this regard?

Isaac Savage December 11, 2023

Figured it out.

Screenshot_1.jpg

2 votes
Jesse Kona March 31, 2022

As a workaround, you can create a comment that has all of the comments from the triggering issue concatenated.  In the automation, after cloning the issue, create a branch to update all created issues, then add a step to create a comment.

Automation 2022-03-31 074045.jpg

Use the smart-value:   {{triggerIssue.comment.body}}

Automation Step - Add Comment 2022-03-31 074350.jpg

Gary Spross
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 13, 2023

I found that this is actually a better way to do it. The other way allows for each comment to be copied over individually (so separate comments), however, there is no guarantee that the comments will post is sequential order. If there's more than 1 comment, this can be confusing on the cloned issue.

Copying the comments over into a single comment allows the sequence to remain preserved (I ordered it using ".reverse" so it was in a descending order). The only note is that the comment field is limited to 32,767 characters, so beware if there are many novel sized comments being copied.

Like Jesse Kona likes this
0 votes
Ivanna June 5, 2023

Hi @Gary Spross  ,

I don't know why can't the cloned issue be linked, my automation is failed.

Please help me,thank you.1686032962097.jpg1686032981037.jpg

0 votes
Patrick Brouchet April 4, 2023

if it may help don't forget to change the perimeter of the rule in the rules details menu, by default the rule apply for one project only. Only admin can change this.

0 votes
Sebas January 2, 2023

Hi @Patrick Seamars 

thanx for your answer, works perfect when cloning an issue. 
One question, is it possible to genereate this comment with all the previous comments combined but then sorted by date descending? it defaults with an ascending order. 

hope you (or someone else) can help me out! thanx in advance

0 votes
Laura Campbell _Seibert Media_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 24, 2020

Hello @Tushar.Kamble 

 

Our app Elements Copy & Sync would let you copy comments (as well as any fields or attachments you want) when you cloning the issue. You can also chose if you want the copied issue to be synchronized with the original.

The Cloud version is not yet available on the Marketplace, but you can sign up to get updates about the release: https://copy-sync-cloud.elements-apps.com/

0 votes
Thomas Magny-Garcia
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 6, 2019

Hi @Tushar.Kamble

I don't think so because the comment should be related to the issue. Even if you clone it, you may want to begin another story, sorry.

Otherwise, you can try to export to CSV file your issue and then import it. I am not fan of this method but it works sometimes.

Hope it helps !

Suggest an answer

Log in or Sign up to answer