JQL: Using filters and subscriptions

JQL: Using filters and subscriptions

If you find yourself searching for Jira issues weekly, daily, (or hourly!), you will benefit immensely from setting up filters, dashboards, and subscriptions to make your life even easier.

Filters: Save your search

Don’t perform a search over and over again: save it for easy access next time! Once you run your query in JQL and get a result that you like, click the “Save as” to save this as a filter to see later.

Once that is saved, you can click the “Share” button to grab a shareable link to your filter, or send it to someone on your team.

Clicking on the “Details” link will let you see sharing controls (permissions) and subscriptions.

Subscriptions: stay on top of your tickets

Jira subscriptions keep you abreast of important issues when they arise. A subscription in Jira means it will run a query on a scheduled basis and email the result to you or a group of people. If no issues meet that query, Jira will not send email. Subscriptions can be configured on a flexible basis.

I’ve personally found subscriptions useful in two cases: critical issues and keeping pace on overall stats. When a team member files a critical issue, I use a subscription every 15 minutes to ensure I meet my SLA and assign those issues out to the team. I also run a daily subscription to keep track of new issues that came in that day. If you use filters in your email, Jira prefixes subscription email with “[Jira] Subscription” so you can route subscription email to a different place than standard Jira email.

Developers: Time to REST!

Jira also has a RESTful API to access issues from Jira. We’ve all been in the situation where we needed to pull out data from our issue tracker but didn’t have the facility to do so. We were then relegated to SQL queries at a minimum that looked like this:
[cc lang=’sql’ line_numbers=’false’]
SELECT distinct pkey
FROM jiraissue
WHERE workflow_id IN (SELECT entry_id FROM os_historystep WHERE action_id=
<transition_id> AND finish_date > ‘<start_date>’ AND finish_date < ‘<end_date>’)
[/cc]

JQL is great as it’s an easy interface to query Jira. SQL queries are hard. They include:

With REST you can use the same JQL query in the UI as you do in REST. The REST endpoint for search returns structured JSON data that’s easy to process and manipulate. I’m going to do some focused tutorials on this topic soon, but wanted to give a quick starter for those who have not used it before. You can run this command in the terminal on the Macintosh or Linux workstation. Windows users will need to get curl. If we wanted to pull all of the duplicate issues from the ANERDS project we could simply call the search REST endpoint.

curl https://jira.atlassian.com/rest/api/2/search?jql=project=anerds%20and%20resolution=Duplicate

The query will return JSON which you can then process in your client application. Again, more on this in a future post.

In closing

At this point you should be feeling pretty good about querying Jira to pull issues with JQL and using those results. If you haven’t yet read the other posts in this series, check them out below:

Exit mobile version