How do I query Jira to search for all issues that have been resolved within a length of time from when it was created?
Asked Answered
L

5

15

For example, let's say I need to find all issues that were resolved within 1 week's time. I need something like:

resolved - created < '1w'

Another example:
Let's say I have 3 issues:

1) created 2 days ago, resolved 1 day ago.
2) created 5 days ago, resolved 4 days ago.
3) created 3 days ago, resolved 1 day ago.

I need a query that will return 1 and 2, but not 3. I need to query for issues that are created at some day X, and resolved <= day X+1.

Limekiln answered 2/12, 2011 at 20:36 Comment(2)
It might be simpler to use a custom field set to the value you're looking for maybe, set using a workflow function or Jelly script.Hesitant
I thought about that too. It seems a reasonable suggestion if you can figure out a way to calculate the field in the workflow step.Dispense
D
2

So since this does not seemed to be built into JIRA by default my only other suggestion is to see if you can extend JQL to add it.

How's your Java? See how to add JQL to JIRA

Dispense answered 2/12, 2011 at 22:39 Comment(1)
My Java abilities are virtually non-existent. But I suppose I have no choice but to give that a shot. Thanks for your efforts, nonetheless. Let me know if you find anything else!Limekiln
D
38

You have all sorts of control with queries. For example, here is how I check for my tickets that are on hold that I have not updated in the last 5 days.

currentUser() AND status = "On Hold" AND updated <= -5d

Created in the last 5 days would be:

created >= -5d

Resolved in the last 7 days would be:

resolved >= -7d

OR

resolved >= -1w
Dispense answered 2/12, 2011 at 21:40 Comment(4)
Unfortunately, this doesn't help me. Let's say I have 3 issues: 1) created 2 days ago, resolved 1 day ago. 2) created 5 days ago, resolved 4 days ago. 3) created 3 days ago, resolved 1 day ago. I want a query that will return 1 and 2, but not 3. I want to query for issues that are created at day X, and resolved at day X+1.Limekiln
Ah, I see. I misread the first time. I thought you were just asking for resolved in the last week, not resolved within a week. I will think about it and update my answer.Dispense
I updated my wording in the description as well, hopefully that reduces confusion.Limekiln
Yeah, I am beginning to think this functionality does not exist in JQL by default.Dispense
H
3

I don't know if it matters yet but I resolved it with dateCompare():

issueFunction in dateCompare("", "created > resolved -5d"))
Helgahelge answered 31/10, 2014 at 19:16 Comment(1)
that one needs ScriptRunnerUnbeatable
D
2

So since this does not seemed to be built into JIRA by default my only other suggestion is to see if you can extend JQL to add it.

How's your Java? See how to add JQL to JIRA

Dispense answered 2/12, 2011 at 22:39 Comment(1)
My Java abilities are virtually non-existent. But I suppose I have no choice but to give that a shot. Thanks for your efforts, nonetheless. Let me know if you find anything else!Limekiln
U
0

So, you want to see all issues where (Resolved date-Create Date) < 1 day Or 2 days, or 3 days. I think I'd create a (hidden) calculated custom field that shows Resolved-Created and use an Exact Number Searcher on it. Or maybe write a custom JQL function to do the same thing. No way to do it in standard JIRA.

Unprepared answered 8/12, 2011 at 19:44 Comment(0)
S
0

This finds all issues, that were resolved the same day they were created, within the specified period:

project = MyProject AND created >= 2021-11-29 AND created < 2021-12-05 AND issueFunction in expression("", "created.clearTime()==resolutionDate.clearTime()") ORDER BY created DESC, updated DESC

Where this part

created >= 2021-11-29 AND created < 2021-12-05

is any period you're looking for issues within and

issueFunction in expression("", "created.clearTime()==resolutionDate.clearTime()")

is the condition that converts the Date-Time format of "created" and "resolutionDate" to only Date-format and compares the received dates with each other.

The topic's task: If you add +1 to created.clearTime() - created.clearTime()+1, you will find all issues that were resolved the day they were created and issues that were resolved the next day (+1 day from the creation date).

Note, that you need to use a plugin (I'm using ScriptRunner).

Supercilious answered 3/12, 2021 at 13:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.