Most Recent Comment with User Name/Email

Mathew Lederman
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.
January 8, 2025

We are using ScriptRunner to populate a scripted custom field called 'Most Recent Comment'. The simple script (below) updates the field with the latest comment. However, when a user is mentioned in a comment, it pulls in the user's Account ID rather than their Name/Email. Does anybody have any alternatives or solutions for this issue?

This worked seamlessly in Datacenter, but due to Atlassian's attempt to replace us all with Account IDs in Cloud it's causing serious issues for our users.

 

 

def comments = issue.fields.comment

// Get the last comment

def lastComment = comments.comments ? comments.comments[-1] : null

// Return the comment body if it exists

if (lastComment) {

    return lastComment.body

}

return null

1 answer

1 vote
John Price
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.
January 8, 2025

Hey Mathew -

These days I'm using Automation rules instead of Groovy, so I tested it that way and it works fine in my instance. I'm doing an Edit Issue Fields action triggered by the creation of a new comment and setting it to:

{{issue.comments.last.body}}

 and it works perfectly with mentions.  Not sure if your users are Managed or not in Cloud, but maybe there's also a relationship to user privacy settings at https://id.atlassian.com/manage-profile/profile-and-visibility.

Try doing Automation (super easy) and if that works, it's a Groovy difference. If not, probably user privacy settings.


Mathew Lederman
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.
January 8, 2025

@John Price do you run into any throttling issues with automation? I'm imagining the global automation rule triggers whenever a comment is made to any ticket, but with my instance of 5000 users that will often be multiple times/second.

John Price
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.
January 8, 2025

Good point. It depends on whether you have Standard or Premium, how often comments are being made, and whether you have the rule trigger on just Issue Commented or also on comment edits and other changes. You could set it up in a single project to start instead of as a global rule and see. The relevant pages are:

https://www.atlassian.com/blog/announcements/cloud-automation-packaging-update

https://support.atlassian.com/cloud-automation/docs/how-is-my-usage-calculated/

 

So for example if you have Jira Standard (there are separate limits for JWM/JSM), you get 1700 executions per month total. But on Premium you get (1000 * 5000) where 5000 is your user count. And Enterprise is unlimited.

The second link also talks about what counts as an execution - things that don't pass conditions are not counted, for example.

 

 

Mathew Lederman
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.
January 8, 2025

We're on the Enterprise plan, which technically means we have unlimited executions to your point, but the API's in use are still rate limited. This is an issue we've run into in the past, specifically around the severe rate limiting of the Assets API.

Like John Price likes this
John Price
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.
January 8, 2025

Gotcha. The limit info is here:  https://support.atlassian.com/cloud-automation/docs/automation-service-limits/

 

As an Enterprise customer (lucky you!), you should lean on your CSM and Atlassian if you run into problems with reasonable use cases like yours. My old CSM was great about pushing requests to Atlassian POs and reporting back to me on the progress of those and highlighted bugs.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events