JQL for searching value of one field equals value of another field

We need to run a search via JQL that will allow us to find issues where the value of the assignee field is equal to the value of the developer field. Obviously assignee = developer doesn't work; it tries to find any issues where the assignee field is set to the word developer. (Developer is a custom field.)

I found this answer which says that ScriptRunner can do it like this:

issuefunction in expression("project = FOO", "assignee = developer")

But a later question with an answer by the same person indicates that the ScriptRunner function will only work if the custom field is a date, datetime or numeric field.

Will the plugin work on a single user picker field, as indicated in the first post? If not, is there any other way to do this? It's something that SQL can do natively, and seems really unusual that Jira would not allow us to do that kind of search with JQL.

1 answer

The documentation of the expression function contains a section named conversions which states:


A String containing the user key. This is sufficient as they are just used for equality comparisons

So, I'd say Script Runner supports username equality comparisons.

Call me an idiot, but that sounds like my sample expression above should work. But it gives me an error: 

Token ("=" at 1:10: "=" ) is not allowed

 1:10 is, I'm guessing, first line, 10th position, which is the equals sign.


I also tried changing it to a double equals, and got this error:

java.lang.IllegalArgumentException: Unhandled custom field: customfield_11200


So I have to assume it's not supported the way you think it is. Note that I'm not trying to create my own JQL functions; I'm just looking to put this directly into a search.


WAIT.  "A String containing the user key." Does that mean that I need to search for specific values? Like, issuefunction in expression("project = PH", "assignee == estrom")? That's exactly what I said I'm NOT trying to do. I don't KNOW the user names. What I'm trying to do is find ANY ticket where the person in the assignee field, whoever they are, is also the person in the developer field. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,022 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you