Finding Issues Owned by Inactive Users with JQL

Kyle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 11, 2013

Is there any way I can get the list of issues reported/assigned to inactive users using JQL easily?

For example:

reporter is inactive() or assignee is inactive()

Or should I have to the the list of inactive usernames and use them like this:

reporter in ( aaa, bbb, ccc, ddd ) or assignee in ( aaa, bbb, ccc, ddd )

Thank you in advance.

13 answers

1 accepted

14 votes
Answer accepted
Petra Goldstein June 24, 2015

Yes, there is a way.

This worked for me: Create a group called, say, "jira-SomeoneWhosGone", add the 'X' inactive user into it, and search for 

  • reporter in (membersof(jira-SomeoneWhosGone))

HTH,

Mike

Kyle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 19, 2015

Well, this approach is somewhat like what i am doing. The problem is, i am not any active directory admin that i can decide on when the inactive usernames will be removed and often, the inactive accounts are moved into a group called "CleanUp". When this group gets wiped out, is totally up to the active directory administrator in my organization. I typically duplicate the username and his information as a Crowd user and marking him InActive. Then i move these users to an InActive group, which will then be used as the top most group for JIRA in Crowd application settings. This way, i am able to mark the user as an InActive one, making this status appear correctly in JIRA, mainly due to Crowd is still unable to query / get the active directory account's inactivity status into Crowd. So your approach won't work in my organization maybe due to its size and its strict policy over active directory maintenance work not delegated to JIRA application admins. Thanks for your answer. Cheers.

Like # people like this
Vilnius Ramanauskas January 11, 2018

Great idea, and no need to create new group - we all already have a group for that. You can use it to filter in Jira interface, not only in API:

  • assignee not in (membersOf("jira-software-users"))
Like # people like this
Ben Sharir November 30, 2018

@Vilnius Ramanauskas inactive users aren't removed from the jira-software-users group by default so this will not work unless the admin manually remove users from the jira-software-users group whenever they deactivate a user.

Vilnius Ramanauskas November 30, 2018

He should do that, Jira counts jira-software-users towards your license tier. You'll end up paying more if being lazy :)

Like J Woode likes this
Ben Sharir November 30, 2018

@Vilnius Ramanauskas that's not accurate, Jira doesn't count jira-software-users towards your license. Jira counts active / inactive status towards your license. You can have (and we do) more users in your jira-software-users group than users you will be billed for. See Remove users from your monthly subscription

Like # people like this
Jose Luis Casarrubias December 15, 2020

I used 

  • assignee not in (membersOf("jira-software-users"))

It worked very good!

Thanks!

Konstantin Ivanov December 31, 2020

@Vilnius Ramanauskas Thanks. It works. I used other name , not "jira-software-users". But solution is perfect

45 votes
Emma Baxter August 29, 2017

Although this is closed this solution might help someone else - devised using the answers above.

No need to add to a group as the access-jira group can be used

(assignee not in (membersof(access-jira)) OR reporter not in (membersof(access-jira)) ) AND statusCategory != done

 

eg, assignee or reporter of currently open issues are currently not active users.

Kyle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 4, 2018

Thanks @Emma Baxter. Best solution so far. Just need more votes! :)

Ben Sharir November 30, 2018

@Emma Baxter this solution won't work unless you have a group called acces-jira and is automatically updated whenever a user become inactive. Maybe older Jira accounts have a this group but our account doesn't have it.

Like # people like this
Daniel G December 24, 2018

Not working with that group

Jeff_Evans June 16, 2020

It's very likely that each organization will have some such group that will serve this purpose, even if it doesn't happen to be named "access-jira" like in this example.  Click on your own profile to see what groups you're a member of, and try those in the query.

Like Christine Diamond likes this
Christine Diamond October 13, 2020

I used "assignee not in (membersof(AllEmployees))" -- I am sure companies vary. Jeff Evans gave a good recommendation to look at some user profiles to see the list of groups.

13 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 11, 2013

JQL tricks has an inactiveUsers() function, or you could add it relatively trivially as your own function using https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+JQL+Functions.

Update: As @MattS points out below (thanks Matt), ScriptRunner has an inactiveUsers() function: https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_inactiveusers

Kyle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 11, 2013

Thanks Jamie. However i can't find your page via your link. Can you provide a new link?

Kyle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 11, 2013

Nevermind. I found your plugin here: https://marketplace.atlassian.com/plugins/com.j-tricks.jql-plugin

Thanks. I'll look into it.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 11, 2013

Not my plugin... happy to give a referral to the "competition" though ;-)

Like Ben Sharir likes this
Kyle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 11, 2013

You can still provide me with your plugin link though. I am open to anything right now. :) Thanks Jamie.

Andrei [errno]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 11, 2013

@Kyle: just remove the dot (".") at the end of the URL Jamie has provided

Kyle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 11, 2013

So desu ne... Thanks a bunch.

vasanth June 30, 2021

the script in plugin is working to me

11 votes
Ben Sharir December 25, 2018

Just search for Assignee = {UserID}. Where {UserID} need to be replaced with the user ID of the inactive user.

Although the inactive user will not come up in JQL autocomplete but it's still searchable and there are many ways to find the userID of inactive users, here's 2 ways:

If you're the admin: go to: Site Administration > Users > Click on user name > User ID will be in your browser's URL 

Example: https://samplecompany.atlassian.net/admin/users/view?username=userID

If you're not the Admin: you can find the userID by clicking anywhere on their name (comment, mention, etc'...) > go to their profile page, the userID will be in the URL in the browser's address bar...

example: https://company.atlassian.net/people/4aa826dd544d8c1a0c124ef1

Then you can make a JQL query like: assignee = 4aa826dd544d8c1a0c124ef1

Hope this helps.

David Wuth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 1, 2019

This is perfect! Thanks!!!

Like # people like this
Кукуруза Андрій June 29, 2021

Only this one useful for me! Tnx!

Like Ben Sharir likes this
5 votes
Ian D July 22, 2013

This thread is a very good question. All too often, a user may get marked as inactive but still has unresolved issues assigned to them. Then, those issues may cease appearing in certain dashboard etc due to the assignee being inactive. Also, you can't just write a query to lookup Issues that are assigned to inactive users ... because inactive usernames won't show in the JQL auto-suggest options.

So, thanks @Jamie for mentioning the JQLtricks plugin. I happen to have that, and in seconds I had my answer by using:

assignee in (inactiveUsers()) and resolution in (Unresolved)

This is a massive jira instance (so don't be shocked when I say): I can now see >400 issues assigned to inactive users. Yikes, thats not good, but at least I can measure and now go manage that :) Thanks folks.

rachel rutti June 5, 2019

Thanks! This one worked for us.

Sanjeev Angadi June 7, 2021

Very helpful, Ian. Thanks

3 votes
Kalen Brown February 15, 2018

No plugin required: "assignee not in (membersOf("jira-users"))" @Vilnius Ramanauskas wins.

Petra Goldstein February 15, 2018

Perfect, .... Unless your system is integrated with AD/LDAP, in which case you need to jump through some hoops to identify the users in the first place in order to remove them from jira-users. 

Like Felix Dzhegutanov likes this
Kalen Brown February 15, 2018

True, if you allow the AD/LDAP to fully manage the user management.  Ours is integrated with LDAP, but ours is set up where we manage the users internally and just use LDAP for authentication only, so every user we want to have access we have to create and manage an account in JIRA, just leave the password stuff to the LDAP integration.  I think we were too worried about the history being broken once the user was removed.  OP didn't really specify the disappearing user problem.

2 votes
Brook Warren July 21, 2020

I solved this and narrowed it down to specific inactive users by doing this:

  1. Do an issue search that shows inactive users in the list of results.
  2. Open one of the inactive users' profiles directly from their name in the list over into a new tab.
  3. Copy their ID off the end of the URL from the address bar in the new tab.
  4. Go back to search and switch to JQL.
  5. add Assignee = <id from step 3>.

Works fine.

It's feasible to just right click an inactive user from the original search list, but there are cases where there are URL replacement characters in the URL that you can't just copy and paste into the JQL, so I didn't get into doing it that way here.

2 votes
MattS
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 19, 2017

Adding a comment here since this page comes up early in Google.

ScriptRunner now has an inactiveUsers() function too

https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_inactiveusers

2 votes
Arek Jarosiewicz August 30, 2017

Just use assignee in (inactiveUsers())

Ben Sharir December 25, 2018

I get this error: "Unable to find JQL function 'inactiveUsers()'Screen Shot 2018-12-25 at 10.51.28 AM.png

Like Jason Cole likes this
Serge_tkint February 15, 2019

You need the ScriptRunner Add-on for this

Laurie Anci September 26, 2019

This worked perfectly!  Thanks!

1 vote
Rob Anteau July 2, 2019

Just include this in your search "assignee in(inactiveUsers())" 

1 vote
Alexander Pappert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 20, 2017

Use the free Addon Jira Misc Custom Fields

Create a new calculated textfield "Assignee.active" with

<!-- @@Formula: (issue.get("assignee").Active != null ? issue.get("assignee").Active : 0) -->

You can search in JQL for this new field, which Returns false when a user is marked inactive

Alexander Pappert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 22, 2017

Use this one to set the unassigned ones to 0

 

<!-- @@Formula:
if (issue.get("assignee") == null)
return 0;

issue.get("assignee").Active
-->

Serge_tkint February 21, 2019

its not free anymore...

0 votes
Jack Nolddor _Sweet Bananas_ December 12, 2017

Hi @Kyle,
 If you are using Jira Server you can install the FREE app called JQL Booster Pack throught Atlassian Marketplace and use the requested functionality.

After install this app, you should be able to create a query using inactiveUsers() function, that will allow you to find issues reported/assigned to inactive users.

 

You can find the complete information about this JQL function at its Function Reference page.

Kind regards.

Kyle
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 4, 2018

Thanks @Jack Nolddor _Sweet Bananas_. Our experience with free apps in Atlassian market place isn't great. We do not want to depend on free apps as they can become commercial apps.

Jack Nolddor _Sweet Bananas_ April 4, 2018

It is entirely understandable.

Serge_tkint February 21, 2019

Nice, I  appreciate it to be free!
I hope it stays this way.... :-)

Sami Koivumaki January 28, 2020

Not free anymore. :)

Like # people like this
0 votes
Sangavi Siva March 1, 2017

JQL Query:

assignee = X AND resolution is EMPTY

where, X= Inactive/active user whom you search for. This query list all the related tickets assigned to that person.
 

Suggest an answer

Log in or Sign up to answer