Query "assignee was currentUser()" doesn't work

Brandon Johnson September 15, 2022

In the browser I can query "assignee was currentUser()" and get results just fine, and when my company was using jira server this JQL also worked just fine through the API, but now that we've moved to jira cloud I'm getting an error "A value provided by the function 'currentUser' is invalid for the field 'assignee'."

Looking at the documentation it does indeed say that "=, !=" are the only allowed values. I'm just confused as looking at the old docs it also said "WAS" is not allowed but it worked then, and now it doesn't work through API but does work in the browser.

2 answers

1 accepted

1 vote
Answer accepted
Brandon Johnson September 20, 2022

The user had not been assigned to a ticket yet, once I assigned the user to a ticket for the first time the error no longer appears and things work as expected.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 20, 2022

Good find!

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 15, 2022

Hello @Brandon Johnson 

Welcome to the community.

The documentation link you provided is for the Server/Data Center hosted product, and also for Service Management. 

Screen Shot 2022-09-15 at 10.27.42 AM.png

To confirm, are you trying to execute your query against a Service project, or a Software project?

If you are getting the error in an API call can you please provide the full text of the API call and any variables that you are using in it?

Brandon Johnson September 15, 2022

Software project. correct software cloud docs are the same. Thank you for showing me my look at older versions was in the wrong place though.

There is no error in the UI

query:

(assignee = currentUser() OR assignee was currentUser()) and project = SR and status not in ("Closed", "Warranty Period") and updated >= currentLogin() ORDER BY key ASC

just for fun I also did it without the first "assignee = currentUser() OR" bit too. This has the same results: UI works fine and API errors with the error

A value provided by the function 'currentUser' is invalid for the field 'assignee'.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 15, 2022

Can you please provide the full text of the API call and any variables that you are using in it?

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 19, 2022

I have not done much work with using the JIRA REST API via python

I found this page which gives an example of an alternate implementation, still using python and the requests library. In this alternate the special characters with the JQL are not encoded. Instead the JQL is just a string enclosed in quotes.

Brandon Johnson September 20, 2022

It was a really silly thing, see accepted answer.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events