Forums

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

Can I use if statements in JQL?

Dave Van Hecke August 22, 2025

Can I use IF / conditional statements in JQL? For example, "search for stories IF they match an Epic created in the last 30 days."

2 answers

1 vote
Shawn Doyle - ReleaseTEAM
Community Champion
August 22, 2025

Hi @Dave Van Hecke 

 

You can do this directly in JQL, issuetype = Epic AND created >= -30d. The IF is implied,

Dave Van Hecke August 22, 2025

Thanks Shawn.  Perhaps more of a nested IF ?JQL-IF.jpg

It wouldn't let me post the text, HTML error.

 

I want just the Bug, Task, Story, but for those Epics created in the last 30 days.

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.
August 22, 2025

Hi @Dave Van Hecke -- Welcome to the Atlassian Community!

Yes, and...to the suggestions from @Shawn Doyle - ReleaseTEAM 

First thing, I recommend looking at some of the free training Atlassian provides on using JQL to search for issues.

 

Next, you have different criteria for your Epics than for the other work item types.  In that case, it helps to restructure your query like this:

conditions that apply to everything
AND (
(conditions that apply to Epics)
OR
(conditions that apply to Bug, Task, Story)
)

The parentheses are key to ensure the correct grouping of the conditions.

 

Kind regards,
Bill

Like Maria Rusnakova likes this
Dave Van Hecke August 22, 2025

This seems to work, but I need to do more testing and confirm with a colleague on the results.  Thank you!

Like Bill Sheboy likes this
0 votes
Trudy Claspill
Community Champion
August 22, 2025

Hello @Dave Van Hecke 

Do I understand your requirement correctly?

You want

- issues of particular types (not the Epic type)
- where those issues are also in a subset of Statuses
- where those issues are also children of Epics
- where those Epics were created in the past 30 days

If I have understood correctly, that is not possible to do with just native Jira JQL functionality.

Is this a one time need or an ongoing need?

What do you need to do with the output? Would it be sufficient to send the list of issues to somebody in an email, or do you need to present the information in a Jira Dashboard or...?

If you only need to send a list to somebody via email then there may be a work around available using Automation Rules.

If you need to be able to get the results as a Filter for use elsewhere (in an agile board, in a Jira Dashboard gadget), then what you would want would be something like this:

project = X and type in (A, B, C) and status in (M, N, O) and issue in childrenOf("type = Epic and created > -30d")

The italicized part is not possible with only native Jira JQL functionality.

There are a variety of third party apps that extend JQL functionality and would provide the functionality suggested in the italicized portion of the JQL. Are you willing to consider third party apps, or do you know if you have any such apps already?

Dave Van Hecke August 22, 2025

Since this is a corporate environment, I can't install 3rd party apps without a lengthy approval and testing process, and that's assuming they approve the cost.  It has long seemed that nearly all the functionality questions to these boards are answered with a 3rd party solution, instead of an update by Atlassian.  These aren't narrow, custom features users are looking for, in most cases it's functions that seem obvious - like your italics above.  
@Bill Sheboy's suggestion above got me a step closer, need to test some more, but this is the kind of creative solution that we'd like to see more of instead of just another 3rd party app.

Trudy Claspill
Community Champion
August 22, 2025

If I understood your requirement then @Bill Sheboy 's solution unfortunately will not meet it.

It will select a group of Epics and a group of non-Epics, but it won't select the non-Epic issues that are specifically children of the Epics.

You would need to use a filter to get a list of the Epics that were created in the past 30 days.

You could then add a criteria to your non-Epics filter for:

parent in (comma separated list of the keys produced by your Epics filter)

 

 

Do you have access to any third party apps already in your environment? You may already have one that would be useful for this.

If you expand Apps in the navigation bar, what do you see?

Screenshot 2025-08-22 at 2.40.31 PM.png

Like # people like this
Dave Van Hecke August 22, 2025

JIRA_Apps.jpg

None.

Trudy Claspill
Community Champion
August 22, 2025

That is unfortunate.

You did not answer my earlier questions about whether I understood your requirements correctly or how you want to use the output.

If Bill's solution is not actually going to meet your requirement, depending on your use case for the output there may be other options that don't require a third party app.

Dave Van Hecke August 22, 2025

- issues of particular types (not the Epic type)  YES
- where those issues are also in a subset of Statuses  YES
- where those issues are also children of Epics  YES
- where those Epics were created in the past 30 days  YES

Is this a one time need or an ongoing need?  ONGOING

We do a Sprint Prioritization meeting with our business users once a month.  We provide them a full list of open JIRAs and need to identify the business priorities.  The items that have been prioritized are given a number in a Custom field (Business Priority).  The others that were requested since the last meeting (>=-30d) but do not have a value in the above Biz Priority field need to be identified.  Note: All the new requests are created as Epics. I can identify these manually in a spreadsheet, but I'm trying to automate the  (many, many steps) cleanup and organization of the spreadsheet and having the Epic as a visible would help, but I need only the ones related to the Story/Task/Bug IDs and again, >=-30d.   Hope that makes sense? It's Friday, it's possible I'm not thinking as clearly as I was earlier in the week. 😁

Suggest an answer

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

Atlassian Community Events