Use JQL to retrieve last created issue in relation to component

manne skoog October 4, 2012

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

0 votes
Answer accepted
manne skoog October 16, 2012

This can not be done using JQL

Bodavo June 25, 2021

As of 2021, with JIRA automation (JQL and smart values) you can accomplish this, see this automation rule.

1 vote
Norman Abramovitz
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.
July 18, 2013

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

1 vote
MatthewC
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.
October 4, 2012

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

manne skoog October 4, 2012

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....

MatthewC
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.
October 4, 2012

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.

0 votes
jay patel July 18, 2013

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 .

0 votes
manne skoog October 4, 2012

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

Suggest an answer

Log in or Sign up to answer