PU - Using JQL functions
The following custom JQL functions enable you to expand your search in Jira:
- commentedIssues
- issuesParents
- issuesSubtasks
- linkedIssuesHasStatuses
- membersOfProjectRole
- transitionCount
- transitionDate
- transitionReporter
- transitionReporterGroup
- userCommentedIssues
- groupCommentedIssues
- relatedIssuesByField
- relatedIssuesByQuery
JQL Functions
Be careful with JQL functions as they might be too powerful for some Jira instances. We recommend that you configure these functions so that your Jira performance is not affected.
JQL functions | Description | Examples |
---|---|---|
commentedIssues(timeframe) | Returns issues that have been commented by a currently logged in user within the specified time frame. To perform such search, you must have the "browse issues" rights. |
|
issuesParents(JQLquery) | Returns a list of issues that are parents of all issues inside the specified JQL query. | issue in issuesParents("Project = PRDT") |
issuesSubtasks(JQLquery) | The issuesSubtasks function returns a list of issues that are subtasks of all issues in the specified JQL query. | issue in issuesSubtasks("Project = PRDT") |
linkedIssuesHasStatuses(Status, linkingType) | Returns tickets that have linked issues which are in the specified status and that are linked with the specified linking type. For example, you have a ticket A, and it's cloned by ticket B which is in progress. The following: issue in linkedIssuesHasStatuses("In Progress", "clones") will search for the tickets that
...and then it will display the tickets that this ticket B clones, in our case this is ticket A. |
|
membersOfProjectRole(Group) | Returns the users who are the members of a certain role inside the Jira project. |
|
transitionCount(Project, Status, Count, Operation) | This JQL function enables you to get a list of tickets in the specified project (first parameter) that were in a certain status (second parameter), X amount of times (third parameter) with a certain operation (fourth parameter - possible options">", "<", "=", ">=", "<=", "<>"). |
|
transitionDate(Duration, Status) | This function returns a list of tickets for which the status was changed within the specified time frame (first parameter) to the specified status (second parameter). For example, "2h" would mean within the last 2 hours. |
|
transitionReporter(User, Status, Project) | Returns a list of issues where the status was changed by the specified user (first parameter) to the specified status (second parameter) within the specified project (third parameter, optional). |
|
transitionReporterGroup(Group, Status, Project) | Returns a list of issues that were transitioned by anyone from the specified group (first parameter) to the specified status (second parameter) within the specified project (third parameter, optional). |
|
userCommentedIssues(User, Duration) | Returns the issues that have been commented by a particular user within the specified time frame, for example, within the last 5 hours. To perform such search, you must have "browse issues" rights. 18416993 |
|
groupCommentedIssues(User, Duration) | Returns the issues that have been commented by a particular group within the specified time frame, for example, within the last 5 hours. To perform such search, you must have "browse issues" rights. |
|
relatedIssuesByField(query, customFieldId) | Returns issues that contain issue keys of other issues in the specified field. |
|
relatedIssuesByQuery (query1, query2) | Allows to apply Query2 for the Query1 results. It returns issues according to the following algorithm:
| JQL 1 = "project = TEST and assignee = test" relatedIssuesByQuery("project = TEST and assignee = test", "key = SELF_VALUE and AND \"Start Date\" > startOfDay()") JQL 1 starts running inside the function and, for instance, will find the following tasks: Then, it will perform the following calls and accumulate the results. |
Examples
Finding user's commented tickets
The following example will help you find tickets where the Tester6 user commented anything within the last 5 hours.
- Go to Issues > Search for issues.
- If there are existing search criteria, click the New filter button to reset the search criteria.
If the basic search is shown instead of the advanced search, click Advanced.
Enter your JQL query. As you type, Jira will offer a list of "auto-complete" suggestions based on the context of your query. Note that the auto-complete suggestions only include the first 15 matches, displayed alphabetically, so you might want to enter more text if you can't find a match.
For example:
project = PRDT and issue in userCommentedIssues("Tester6", "5h")
- Press Enter or click
Configuring a JQL function to prevent Jira performance issues
The following example will help you set the parameter in JQL function to prevent Jira performance issues.
- Go to Issues > Search for issues.
- Enter your JQL query.
For example: issuekey in issuesParents("project=TP"). - Your search results should be displayed in the issue navigator but it returned an error because the amount of results could be too large and could affect Jira performance.
- To prevent the error, ask your Jira Administrator to configure JQL functions in a way that allows more results.
- Enter your JQL query again.
Note that due to server specifics increasing the limit might not be an option. In that case you need to re-run the JQL query in a way that you don't get too many results.