Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,508,970
Community Members
 
Community Events
181
Community Groups

Jira Automation: copy comments from trigger issue, is it possible?

Good afternoon all!

 

I have this question, an user is asking to create a rule to create a new issue based on data from trigger issue in a different project. 

The problem I have is that information that he needs includes comments. He wants to copy all comments (or internal notes only if it's possible) to this new issue in project AA

How can I copy the comments? maybe including a json? how should it be?

 

thanks in advance,

Ro

2 answers

1 accepted

1 vote
Answer accepted

Hi @Rosana Casilli 

The issue comments are a list smart value, and so you could iterate over them to add to the new issue.  Please look here for information about the field: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--issue.comments--

Next, you asked about filtering to only copy the internal ones.  That can be done by using smart value, list filtering.  There is an example of filtering on internal comments in this article: https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588

Kind regards,
Bill

Thanks @Bill Sheboy

 

I have another question (sorry! but never worked with comments on automation)

can I copy the comments from the original to the new issue? Because I have try to copy to a custom field, and worked but do not know  how to copy the original comments using smart values you suggested into the comment section in the new issue.

Is there any way? or should I use this custom field?

 

thanks in advance

Ro

Hi, Ro!

Although you could use a custom field to store the copy, you could also add them as comments, either as one giant comment to the new issue or one-by-one (with an advanced branch).  If you take a look at those links I provided they show examples of how to iterate over the comments list for an issue.  For example:

{{#issue.comments}} 
Comment by: {{author.displayName}} at: {{created}}
{{body}}
{{/}}

 

Please note: if you copy them with an automation rule, there is currently no ability to sort a smart value list.  That means when you add the comments they will appear in a random order relative to the comments' date/time added.  If you want them in the order they were added, please investigate a marketplace addon, as @John Funk suggested.

Thanks,
Bill

Like # people like this

Still don't know where to put this and how.

I do not have "Comment" field available on "choose field to set". So, how can i associate:

{{#issue.comments}} 
Comment by: {{author.displayName}} at: {{created}}
{{body}}
{{/}}

to the comment field?

After the issue is created, you may branch to it and then use the Comment Issue action.  For example:

  • trigger: whatever you are using
  • action: create issue
  • branch: on most recently created issue
    • action: comment on issue... adding information from the trigger issue to the new one
{{#triggerIssue.comments}} 
Comment by: {{author.displayName}} at: {{created}}
{{body}}
{{/}}
Like # people like this

Thanks Bill, but this won't work for my scenario.

My scenario is:

I have an issue in project A and want to copy or clone to Project B, and all comments from issue in  project A should be copy to the new issue in project B. 

 So when the Branch section is executed, it is looking for most recently created in the current project A (In the rule restricted to projects cannot be edited) 

If this rule is running as a global/multi-project scope, I believe that would still work. 

If the most-recently-created branch does not work, a global/multi-project rule could still use JQL for your created issue key for the branch.

Please note, that there are execution limits per month for global/multi-project rules, so check with your site admin to confirm your limits before trying a global rule.

A more elaborate work-around which does not require a global/multi-project rule is to call the REST API from a web request in the rule to add the comments.

3 votes

Hi Rosana,

We actually use the add-on called Deep Clone to do this. 

Thank you john! but there is no budget for add-on right now.. :(

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events