Comments
hasComments
hasComments([number of comments])
In the simplest form, finds issues with comments:
issueFunction in hasComments()
What is issueFunction?
Do use issueFunction
in and not issue in
. It is done this way for performance reasons. issueFunction
is just a custom field that will be added by the plugin. If the name doesn’t make sense in your language it’s safe to rename it, although for consistency with the documentation it’s probably best to leave it as is.
Alternatively you can find issues with an exact number, or greater or fewer comments than specified. Eg exactly 3 comments:
issueFunction in hasComments(3)
More than 5 comments:
issueFunction in hasComments('+5')
Less than 3 comments:
issueFunction in hasComments('-3')
commented
commented(comment query)
commented
is for searching for issues by attributes of their comments. Example, to find issues that have been commented on recently:
issueFunction in commented("after -7d")
issueFunction in commented("after 2012/12/31")
Find issues commented by jbloggs within the last 4 weeks:
issueFunction in commented("after -4w by jbloggs")
Find issues that have a comment visible only by role Developers:
issueFunction in commented("role Developers")
Find Service Management issues that have internal comments. This will return only Service Management issues with comments that are internal:
issueFunction in commented("visibility internal")
Find Service Management issues that have external comments and are by 'jbloggs'. This will return only Service Management issues with external comments that written by jbloggs:
issueFunction in commented("by jbloggs visibility external")
Issues commented in the current month by the current user:
issueFunction in commented('after startOfMonth() by currentUser()')
Issues commented in the previous calendar month by the current user:
issueFunction in commented('after startOfMonth(-1) before endOfMonth(-1) by currentUser()')
The following predicates are available, you can use as many as you like:
Table 1. Predicates
Name | Argument Type |
---|---|
by - comment by this user | username or user function, eg currentUser() |
after - commented after | date or date expression, or date function, eg startOfDay(), lastLogin() |
before - commented before | date or date expression, or date function |
on - commented on this day | date or date expression, or date function |
inRole - comment was made by a member of this role name, for the issue on which the comment was made | role name |
inGroup - comment was made by a member of this group | group name |
roleLevel - comment is restricted to this role level | role name |
groupLevel - comment is restricted to thisgroup level | group name |
visibility - comment is a Jira Service Management comment with this visibility setting | internal or external |
For backwards compatibility role and group are synonyms for roleLevel and groupLevel, and application only to the commented function.
Using standard JQL functions as an argument type is supported.
lastComment
lastComment(comment query)
lastComment
is similar to commented
but is restricted to searching only the last comment for every issue.
This can be very useful for "support" workflows, where you want to ensure that customer comments are dealt with in a timely manner. For example, to find issues in a project where the person last commenting is not in the Developers role:
project = FOO and issueFunction not in lastComment("inRole Developers")
To find issues where the last comment was made by someone with the User role (and not the Developer role), and it was greater than 4 hours ago:
issueFunction in lastComment("inrole Users before -4h") && issueFunction not in lastComment("inRole Developers")
Do not confuse roleLevel and inRole. Role level is the security level of the comment, "in role" refers to the role(s) of the person making the comment in that project.
Performance Characteristics
There are different factors that make up the overall time taken for this query:
The total number of comments in the system… in testing on a low spec machine, it requires around 400ms for an instance with 350k comments. If you have one millions comments, the cost will be about 1.2 seconds, on a low spec machine.
The number of issues returned by the query, eg "by jbloggs". If your query matches hundreds of thousands of comments it will take an additional second or two.
Any additional clauses that you AND or OR together with this one are irrelevant.