Automation: how to copy the last comment of an issue to a custom field in JIRA?

Giorgio Crosali August 4, 2021

As the title suggests, I'm struggling to create the proper JSON script and I'm not allowed to use plugins

3 answers

1 accepted

4 votes
Answer accepted
Bill Sheboy
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.
August 4, 2021

Hi @Giorgio Crosali 

You could use the built-in automation for Jira rules for this, such as:

  • trigger: issue commented
  • action: edit issue for your custom field, setting it to the last comment's body, or other contents.

Please look here for information about automation to get you started:

 

Best regards,
Bill

Alex
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.
August 4, 2021

Hey @Giorgio Crosali 

Following @Bill Sheboy answer, I can share an example:

automation-example.png

 

Cheers,

Alex

Like # people like this
Giorgio Crosali August 4, 2021

thanks to you both @Alex and @Bill Sheboy - I've managed to get the expected result

Like Bill Sheboy likes this
Stephanie Kohne
Contributor
January 25, 2022

Hi @Alex 

After much digging and diving, your solution to this automation works perfectly for me, however how do I exclude Internal comments from being populated in my custom field "last comment" 

 

This is as far as I have gotten:

Capture.PNG

Stephanie Kohne
Contributor
January 25, 2022

I got it to work!

Capture2.PNG

Like # people like this
1 vote
David T Jones July 10, 2023

One other suggestion, you can run a scheduled rule to update all unresolved issues if you want to backtrack the change and update all the open tickets to have last comment populated. 

Also, if you want to make it a short text field you can insert .left(255) in the value to truncate it if you don't want the last comment field to end up being huge

{{issue.comments.last.body.left(255)}}

0 votes
Emilia KASPRZYK
Contributor
May 17, 2023

Guys, i love you, thx works prefectly ;)

Suggest an answer

Log in or Sign up to answer