Use JQL to retrieve last created issue in relation to component

I'm trying to use advanced JQL in order to find the last issue created in a project relating to one or several componentents but I'm struggling to limit the results to the issue that was created last.

project = "project x" and component = "Component y"

Delivers all issues but I only want the Issue that created last, any ideas?

5 answers

1 accepted

Accepted Answer
0 votes

This can not be done using JQL

Something similar has been discussed here. Have a read of Jobin's answer:

https://answers.atlassian.com/questions/20653/jql-project-dnatest-and-rownum-10-how-to-use-rownum

There isn't a JQL function to do it but if you use the REST API, you can restrict the number of issues returned.

Other than that, you would "order by created DESC" to get the last one created at the top of the results

Thanks, am using the on demand version so REST wouldn't be an option. That aside I was looking for a way to create something like a "monitor" were I'd ask a somewhat more complex question than the one stated in my example above.

project = "project x" AND component in ("Component y","Component Z","Component x")

and then only display the last issue created for each component but maybe it can't be done....

You might want to check, you should be able to use REST for Jira onDemand.

https://answers.atlassian.com/questions/34495/rest-api-for-ondemand

and

https://confluence.atlassian.com/pages/viewpage.action?pageId=253231624

But I think you're right in that there is no way to do what you want in JQL in onDemand.

You are right about REST API, i will check it out.

sir , i am a very much fresher using JIRA and confluence . i am also doing similar work where i need to make sure that " ALL THE ISSUES CREATED IN JIRA SHOULD HAVE jira project COMPONENTS ASSIGHNED TO IT AND THERE WILL BE ONE PAGE WHERE PEOPLE CAN SEE WHAT ARE THE ISSUES GOING FOR A PERTICULAR COMPONENT . whEN ANY ONE CRAETE NEW ISSUE THIS PAGE WILL ATOMATICALLY SHOW THIS ISSUE UNDER RELATED PROJECT COMPONENT " any help will be much appriciated .

I would add an order by clause either on created or the key to bring the latest entry to the top of the list. At least the issue you are looking for would be the first one listed.

order by created desc

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

25,072 views 2 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you