Forums

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

How to Add condition in automation "if the comment was added within 5 minutes of ticket creation"?

Radia Dev September 9, 2025

Hello Community,

I'm trying to add one condition in automation, and my question is as follows:

How do I add a condition in automation that states, "if the last comment (which is the trigger) was added within 5 minutes of ticket creation"?

Could someone please help me with this?

Thanks,

Dev Radia.

2 answers

1 accepted

2 votes
Answer accepted
Jack Brickey
Community Champion
September 9, 2025

I wonder if you could simply use a JQL condition - Created >= 5m and Created <= -5m

it's basically test to see if the issue was created in the last five minutes. You're already triggering on the comment being added so I don't think you need to test when the comment was added in this case.

Jack Brickey
Community Champion
September 9, 2025

With that said, we might be able to come up with a better solution if we just understood your use case more completely.

Radia Dev September 9, 2025

We are aiming to only resolve cases where specific text is added! Saying that my main action is "When commented," and we're seeing if that comment matches the text we want. However, we want to ensure that the case will be resolved only if the comment is added within 5 minutes of ticket creation.

As you suggested, even if we know the JQL, we cannot add it to automation! If you could please guide... where can we add?

Jack Brickey
Community Champion
September 9, 2025

Testing for Comment text aside, why can you not add the suggested condition to your rule. For example...

IMG_6189.jpeg

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.
September 9, 2025

Hi @Radia Dev 

Yes, and...to the suggestions from @Jack Brickey 

Even during normal processing conditions, automation rules do not always trigger exactly when the event happens that triggered them.  Indeed, this causes a variety of racetrack timing problems in rules.  And so comparing to "now" may not be accurate for your scenario.

With the work item commented trigger, you have the {{comment}} smart value, and that has its created date / time.  For other triggers, the {{issue.comments.last.created}} smart value is available.  Either of those could be compared to the issue's created field using a date / time difference and the Smart Values Condition.  For example:

  • smart values condition:
    • first value: {{issue.created.diff(issue.comments.last.created).minutes}}
    • condition: less than
    • second value: 6

 

Kind regards,
Bill

Radia Dev September 9, 2025

Correct, @Bill Sheboy! Making sense! That worked for me!

@Jack Brickey I tried your solution as well, but in my case, it should be "created >= -5m", which worked!

Like # people like this
0 votes
Marc - Devoteam
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.
September 9, 2025

Hi @Radia Dev 

in theory a condition like this should work, but you would need a custom field that stores the time when the last comment was added.

So you will 1st have to have an automation that stores this information based on when a comment is created.

Then you could have another rule that checks agains this field.

Radia Dev September 9, 2025

Hi @Marc - Devoteam

Yes, this could be a solution, but I wonder if we can do it directly.

Still, even if I create an automation to store the date and time in that field, how will we determine whether the last comment is 5 mintes from that field or not?

Thanks,

Dev Radia.

Marc - Devoteam
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.
September 9, 2025

So then you can have a smart values condition.

{{now.diff(issue.new-custom-field).minutes}} less than 5

https://support.atlassian.com/cloud-automation/docs/jira-automation-conditions/#--smart-values---condition 

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