Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

is it possible to find all boards connected to an inactive user with groovy?


Currently i have a script the gives me all inactive users, 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserManager

// all inactive jira users
UserManager userManager = ComponentAccessor.getUserManager()
userManager.getUsers().findAll{user -> !user.isActive()}.each { user ->

Now i would like to find out if the inactive user also has a board that i can remove, somewhat as below but with groovy. any ideas?


1 answer

1 accepted

0 votes
Answer accepted

Hi @Tomas Gustavsson ,

You can find it direct from DB.

SELECT * FROM ao_60db71_rapidview where owner_user_name='andrewdvizhok';

How request to DB from scriptrunner I already write here


But unfortunately I don't know how delete it through scritrunner. I prefer use selenium to delete boards/schemes/etc in UI, because delete direct from DB or scriptrunner may break system.


This is great, I will not delete then i just need for find what i can delete and then I will use jira for the deletion.


i did get an issue, maybe it is related to my jira version which is 7.6.4 i do get an error.
can you please help?

startup failed: Script44.groovy: 14: unable to resolve class Sql @ line 14, column 5. Sql sql = new Sql(conn) ^ Script44.groovy: 14: unable to resolve class Sql @ line 14, column 11. Sql sql = new Sql(conn) ^ 2 errors

Any idea why?

I have got your original Sql statment to work, the one in the link.

when adding the select statement in your answer here, i get the error message
ERROR: relation "ao_60db71_rapidview" does not exist Position: 16

Yep, in some DB used only upcases. Try 'AO_60DB71_RAPIDVIEW'.


Like Tomas Gustavsson likes this

Is there a way to find out which columns a table as ao_60db71_rapidview holds?

i did and that seams to work, now it complain about column-name


and in code use it.ID and it.NAME


Like Tomas Gustavsson likes this

Super now i got it, thanks for a really great help and support

import com.atlassian.jira.component.ComponentAccessor
import groovy.sql.Sql
import org.ofbiz.core.entity.ConnectionFactory
import org.ofbiz.core.entity.DelegatorInterface

import java.sql.Connection

def delegator = (DelegatorInterface) ComponentAccessor.getComponent(DelegatorInterface)
String helperName = delegator.getGroupHelperName("default");

def sqlStmt = """
def result
Connection conn = ConnectionFactory.getConnection(helperName);
Sql sql = new Sql(conn)

try {
StringBuffer sb = new StringBuffer()
sql.eachRow(sqlStmt) {
sb << "${} ${it.OWNER_USER_NAME}; \n"
result = sb.toString()
log.error sb.toString()
finally {

return result

Like Andrew likes this

Good! But careful because your code return  list all boards, not only from inactive owners. 

Like Tomas Gustavsson likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

455 views 2 6
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you