How to copy the last comment date into a Custom DateTime Field ?

How to copy the last comment date into a Custom DateTime Field ? Is this even possible ?

This should trigger when ever a new comment added to an issue.

1 answer

1 accepted

Hi Andrian,

This requirement can be used using the Script Fields functionality provided by the ScriptRunner Plugin.

The way to do this is to set a new Script Field called Last Comment Added and configure its searcher type to be Date Time Range Picker and ensure this field is set to appear on issues for all projects and issue types.

You should then add the script below to the Script Field

import com.atlassian.jira.component.ComponentAccessor

def comments = ComponentAccessor.getCommentManager()?.getComments(issue)

// If the current Issue has comments then get the date that the last comment was created

if (comments) {
    return comments.last()?.created as Date
}

Finally you should then ensure that the Template for the field is set to Date Time Picker like in the screenshot below and then you will see details of when the latest comment was added such as in the screenshot below.

Screen Shot 2016-10-05 at 12.17.18.png

Screen Shot 2016-10-05 at 12.18.53.png

I hope this helps

Thanks

Kristian

Thank You Very much  Kristian Walker.
This is helpful 

Suggest an answer

Log in or Join to answer
Community showcase
Emilee Spencer
Published yesterday in Marketplace Apps

Marketplace Spotlight: DeepAffects

Hello Atlassian Community! My name is Emilee, and I’m a Product Marketing Manager for the Marketplace team. Starting with this post, I'm kicking off a monthly series of Spotlights to highlight Ma...

50 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot