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
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 firstname.lastname@example.org")
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?
issueFunction in commented("by email@example.com") and comment ~ 'text'
of course don't satisfy my requirement.
Thanks in advance!
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.
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?
@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
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 ")
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
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.
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:
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.
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.
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