Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA Automation: Group qualifying Last Comments by their ages

Colin_Turner February 4, 2025

Hi all! 

Goal: send different Slack messages based on the age of qualifying "Last Comments"

Ex: I add a comment with the keyphrase "PLS_ESCALATE" to items. I want to receive different messages around the time that comment hits ages of 24h, 48h, and 72h, respectively -- if at that time it's indeed still the last comment. 

My current design is to use a "scheduled" trigger running regularly, looking for items with a qualifying last comment, then bucketing them into age intervals to report differently. 

I've got the first part working, but can't find a component+smartvalue pairing to do the second part. Is this a case for advanced branching? If/Else? It's hard to know, because I have no last-comment date analysis working anywhere yet -- not for "issue.last.comment.created" nor for Last Comment.created -- so I am going in circles.

Can anyone advise on how to judge the age of the last comments in JIRA Automation?

Edit: bummer: rubber-duck-debugging style, I see now that it's "comments" in the smartvalues, not "comment" đź¤¦â€Ťâ™‚ď¸Ź, so I may make some progress again, but any advice still appreciated

2 answers

1 accepted

3 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.
February 4, 2025

Hi @Colin_Turner 

You seem to have the smart value expression's attributes out of order.  Please try this to find the age of the last comment added in hours using the diff() function

{{issue.comments.last.created.diff(now).hours}}

 

If that does not help, please post the following for more context:

* what type of project is this (e.g., company-managed, team-managed, JPD, etc.), 
* an image of your complete automation rule in a single image,
* images of any relevant actions / conditions / branches,
* an image of the audit log details showing the rule execution, and
* explain what is not working as expected and why you believe that to be the case.

 

Kind regards,
Bill

Colin_Turner February 5, 2025

Hi @Bill Sheboy, it's a company-managed JIRA cloud project

complete automation:

Screenshot 2025-02-05 at 10.56.51 AM.png

and the error log:

Screenshot 2025-02-05 at 10.59.14 AM.png

I'd like to report the issues whose last comment contains a given string and is between given ages in hours, but it doesn't seem to be reading the smartvalue in identifying them

Colin_Turner February 5, 2025

I got there!

I was surprised that pre-pending "lookupissues" to the smartvalue in the smartvalue comparison component got me over, was a wild shot

Screenshot 2025-02-05 at 11.42.26 AM.png

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.
February 5, 2025

When the scope is a single issue, use the {{issue.someField}} and when using Lookup Issues, it is that scope for the set of issues {{lookupIssues.someField}}

Please note well: if lookup results have multiple issues, that expression will be a list of values, not a single one.  How many issues do you expect the lookup to return?

Colin_Turner February 6, 2025

A handful at most, but if their ages are expressed as a sum, this approach is flawed

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.
February 6, 2025

If the lookup returns multiple issues, you may need to do this in pieces, or adjust the expression:

  • extract the last commented date from all the issues
  • decide / use one of them to perform that diff(now).hours

 

Colin_Turner February 18, 2025

When the scope is a single issue, use the {{issue.someField}} and when using Lookup Issues, it is that scope for the set of issues {{lookupIssues.someField}}

Hi @Bill Sheboy , what about when the scope is within a branch? Even though "VarLastComments.comments.last.created..." works in the If component shown here, it's not what the Slack message is looking for. Two options that didn't work shown

Screenshot 2025-02-18 at 1.18.02 PM.png

Colin_Turner March 4, 2025

For posterity, here's what's worked and where I am on this now.

I tried a number of approaches to segregate last comments by age, got farthest with a Smartvalues Condition, but remained dissatisfied because that SmartValues Condition didn't let me specify both an upper and a lower bound for a range of hours.

An inline #if does not seem to work here (thought maybe I could match on "True")

What did work was expressing the age in days, then matching on whole numbers with "equals" (chaining as many of these blocks of day-numerals as I need to capture), or using the "contains regex" field to match on the range of possible numeral results for a range of hours. Examples of each in image

 

Screenshot 2025-03-04 at 4.31.32 PM.png

Like • Bill Sheboy likes this
0 votes
Colin_Turner February 5, 2025

oops

Suggest an answer

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

Atlassian Community Events