Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira Automation: Exact Time in Status

Akash Panchal September 6, 2023

Hey everyone, 

I'm looking to create the following Jira automation:

- When any ticket is in the status "I'm Open" for exactly 40 minutes, automatically create a ticket

I understand the automation part of it, just having trouble writing a JQL query. Here's what worked for me on first attempt:

project = "XYZ" AND status = "I'm Open" AND status CHANGED BEFORE -40m

The above query within the automation rule created the ticket automatically on first attempt, but when I tested it again it won't create additional tickets automatically. I'm assuming this is because it recognizes more than one ticket over time through that JQL query, thus, not following through with the automation. 

 

Below is a similar JQL query I created that works as well, but is for issues that are greater than or equal to 40minutes:

project = "XYZ" AND NOT status CHANGED AFTER -40m AND status = "I'm Open"

 

In short, I'm simply looking for a way to modify one of the JQL queries above to grab an EXACT time (i.e. =40m). I've read that JQL cannot grab exact times, but is there a work around via automation that could do this?

 

Thanks for the help!!

 

1 answer

1 accepted

2 votes
Answer accepted
David Leal
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 8, 2023

Would you share your rule? how do you plan to trigger the rule, Since your scale is minutes, do you mean to schedule the run on every minute? I don't think it is possible. The minimum is 5 mins, and you would lose tickets since you are looking for exactly 40 minutes.

Akash Panchal September 11, 2023

@David Leal Thanks for the response, here is an example of the automation rule below:

Screenshot 2023-09-11 165151.png

Akash Panchal September 11, 2023

@David Leal Essentially:

When an issue is in the I'm Open status for 40minutes, create a General issue ticket within project ITS automatically. 

David Leal
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 11, 2023

@Akash Panchal I don't think you are going to achieve what you want. The trigger condition is on real time, then the JQL will apply to all the universe of issue that satisfy the condition, not a condition for the triggered issue. I would say there are two issues here:

1. The trigger condition, should not base on issue transitioned (you are looking for something that happened in the past), you would need a rule that is triggered based on schedule, but you have a minimum threshold of 5 minutes, as per my understanding.

2. Because of the threshold of the previous item, you cannot find exact -40 minutes, but rather a range.

I would suggest to create a rule based on schedule of 5 mins, which is not too much efficient, because the rule will run every 5 minutes, then check for a condition based on field status Status Category change for the condition.

For example:Screenshot 2023-09-11 at 6.32.56 PM.png

then

Screenshot 2023-09-11 at 6.33.15 PM.png

You need in some how to be able to not take into account issues that already were processed through the previous call of the JQL, otherwise every time it will be triggered again. For example to add a label when the issue match the condition. For example: PROCESSED or something like that, so next time it doesn't appear in your query. You would need to modify the query to include also issues where the label is not present, for example labels not in (PROCESSED).

Since the rule will run every 5 minutes you will have a threshold of 5 minutes, not exactly 40 minutes.

I think you can put the condition in JQL this way too:

status in ("IN PROGRESS") AND statusCategoryChangedDate <= -40m AND statusCategoryChangedDate >= -45m

I guess you get the idea, so you can adjust it to your specific scenario.

 

David

Like # people like this
Akash Panchal October 26, 2023

@David Leal Sorry for the late response, your guidance above helped me create this scheduled automation rule! The missing pieces for me were using scheduled automation and updating the label system field once an automation rule has been executed. 

Thank you!

Like David Leal likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events