How to obtain currentuser IN membersof("groupA") in JQL ?

Kristof Danckaert January 24, 2018

I need to make several dashboards that show tickets to logged in users IF they are members of certain user groups.  So the same filter should return only tickets IF the logged in user belongs to one of the groups that is responsible for the tickets. 

Example filter (sorry I do not use the full correct JQL syntax, I just want to show my idea here, type is a custom field I use):

(Type = CV and currentuser IN membersof("CVowners"))

OR  (Type = JV and currentuser IN membersof("JVowners"))

OR (Type = OTHER and currentuser IN membersof("OTHERS"))   

This one filter would enable me to show only relevant tickets to the logged in user on dashboard IN CASE the user is member of the user groups that manage them. 

I do not need to make separate filters then, the user gets all the tickets that he needs to see per type if he/she is in the owning group. 

BUT the currentuser can't be used at the left side of the operator IN.  So this is not possible ?   I have the same with assignee IN membersof() and that works super !  

So I can't do this ?  Any other idea to do the same ? 

Thanks !

2 answers

1 vote
Elliot Gates September 12, 2018

From my understanding you cannot search by 'User Roles' which is what your assignments are above (I assume). The MembersOf() deceptively only means the roles listed above.

Kristof Danckaert September 13, 2018

Indeed.  

I managed to do this by using the SQL driver : 

issue in sql("SELECT key from issues where JQL ='component = JV AND assignee in membersOf(INT_JVOWNER)' and memberOf((select jira from aux.currentuser), 'INT_JVOWNER') = true")

 

This gives me tickets of type JV where the assignee is member of a group that handles JV's and the current logged in user is one of that group. 

The last part will show the user tickets of the JV component even if he/she is not the assignee. 

 

Works perfect.  

0 votes
somethingblue
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 29, 2018

Hi Kristof,

That is correct.  The currentuser() supports the Assignee, Reporter, Voter, Watcher and  custom fields of type User fields.

The following are unsupported operators:

    ~ , !~ , > , >= , < , <= IS , IS NOT , IN , NOT IN , WAS , WAS IN , WAS NOT , WAS NOT IN , CHANGED

I did some research and found a Communities post that may help you.  The suggestion was to use ScriptRunner or to use SQL.  Take a look at the post by Vasiliy Zverev and see if you can perhaps modify it to fit your needs.

Cheers,

Branden

Suggest an answer

Log in or Sign up to answer