You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I'm searching for all Jira issues with comments written by a given user and containing some given text.
I'm already aware of how I can search for issues with comments by a given user, for example:
issueFunction in commented("by user@domain.com")
or, if looking for my comments,
issueFunction in commented("by currentUser()")
But I'd like to specifically filter by comments satisfying both conditions: author and content. How can I achieve this?
Queries like
issueFunction in commented("by user@domain.com") and comment ~ 'text'
of course don't satisfy my requirement.
Thanks in advance!
Hi @luca-pittino and @Björn_Schotte
I had tried this jql and get my favorite result
Comment ~ "\"text\"" and issuefunction in commented (" by user@domain.com")
Hi @Ashkan Malekly, I guess your case was a lucky combination :)
Your suggestion is basically the last query I wrote in my question above, with the difference you're searching `"text"` (quotes included).
My problem is that I need to match isses having single comments satisfying both conditions A and B, but I can only get issues with some comment satisfying A and some other comment satisfying B.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hii @luca-pittino
No in my code include ( \ ) this is important.
this is yours: comment ~ 'text'
And this is mine : comment ~ "\"text\""
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry @Ashkan Malekly, I think I've been mislead by the fact that even using quotes I still got many results with comments not matching both conditions (false positives)..
Actually though, the amount of results with and without quotes is different (e.g. ~70 and ~120 respectively).
Maybe something related to Jira app version? I'm using Jira Server 7.1.4, maybe on later versions they did some improvements?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@luca-pittino could you tell me the username and comment? I think you miss somewhere in the code. I want to implement your username and comment in my code give you back and please put it in your search bar. Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does anyone know if there is a way to display the comment text in the results?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is necessary to search for text in the comment of a specific user. i can't find a solution to such a problem in JQL.
issueFunction in commented("by user") AND comment ~ 'text'
- not satisfied with the results.
I want to have something like (fantasizing):
comment ~ 'text' ("by user") //OR// issueFunction in commented("by user / text ~ blabla ")
?)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is exactly what I am looking for, but we're on the cloud version now and get an error.
The URL provided at the end gives a 401 error also; there is no help there either.
The "commented" JQL function provided by "Adaptavist Scriptrunner" for Jira Server works differently in Jira Cloud. Run it directly in "Enhanced Search" instead. See the documentation for more details: https://docs.adaptavist.com/sr4jc/latest/features/scriptrunner-jql-keywords-functions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess the expected doc page is https://docs.adaptavist.com/sr4jc/latest/features/scriptrunner-enhanced-search/jql-keywords.
But again I don't see a solution for the matter...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In answer to both your queries:
We have a documentation page linked here dedicated to highlighting the differences in JQL syntax between ScriptRunner for Jira Server and ScriptRunner for Jira Cloud.
For your search query, if you are trying to use the server syntax:
issueFunction in commented("by <insert user>")
then please replace this with the equivalent cloud syntax:
commentedBy = <insert user account ID>
To achieve the same output in ScriptRunner ES for Jira Cloud.
Please let me know if this solves your query issue.
Kind regards,
Jasmin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I actually figured this out and tried it, but I got zero results. The Example they provided on the page is
If I use something similar:
Text ~5f8eddaaf162650070bce0fb
I get a ton of results. Some of the results are from comments I made, and some are with comments others made and tagged me. Either way, I do get results that prove the formula above is NOT working, oddly. I would like to only filter by the comments I made and exclude the comments where I am tagged. I am still looking for a correct way to do this because the temporary solution I came up with has too many comments I have to view that are not what I need and just become noise.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please can I check a few things:
1. Have you replaced the user account ID, with your own user account ID?
You can find your account ID via this URL: https://adaptavistlabs.atlassian.net/people/
and searching for yourself. The account ID will then appear at the end of the URL.
2. Are you performing the search within the ScriptRunner Enhanced Search application?
You can find the application using the Apps dropdown menu:
And insert your search query here:
3. The search query for the scenario you have described would be:
commentedBy = <your account ID>
This will only return issues that your account has commented on.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
it's complicate to manage some special chars for your condition 'comment ~' (escape with '\' or '\\' )
you have to escape the special chars ex: https://confluence.atlassian.com/jirasoftwareserver/search-syntax-for-text-fields-939938747.html#Searchsyntaxfortextfields-escapingSpecialcharacters
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not with a query unfortunately, nor with Jira filters.
I guess a search with similar expressiveness is unsupported at the moment.
In my case I searched by text, as I got the fewest results, and then manually checked the text occurrences and saw who the comment author was.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.