Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,716
Community Members
 
Community Events
184
Community Groups

Script for deleting filters

Hey,

We have some criteria for Filters to be deleted in our Jira Instance.
Could anyone help with Script in Scriptrunner for below?

We need to create a script that delete filters which fall under these criteria:

  1. filters to be deleted which are owned by inactive users, private and with fav count 0
  2. filters to be deleted which are owned by inactive users, private and with fav count 1
  3. filters to be cleaned up which have Owners that are inactive and Filters are not shared/not favorited by any User )
  4. private filters which is created by inactive users and Fav count <2. 
  5. private filters which is created by inactive users and Fav count 2 & more. 

or any idea is welcome.

Regards,
Anuradha

2 answers

1 accepted

0 votes
Answer accepted

That is a pretty big ask.

I would start by reviewing this post

Jira questions Bulk-Delete-Issues-Using-ScriptRunner 

Work on a base from there and many of us can help beyond that.

Hi @CJ Edwards ,
Thanks but the post you gave is for issues right? not for Filters.

I tried below Script:
But seeing some errors. Could you please help?

image.png

Hi Anuradha,

I would work from the top of the script to narrow the problems.

-  getAllUsers() was deprecated long ago. Use UserSearchService.findUsers() use https://docs.atlassian.com/software/jira/docs/api/9.8.1/com/atlassian/jira/bc/user/search/UserSearchService.html

- for filter work use - com.atlassian.jira.bc.filter - Interface SearchRequestService

https://docs.atlassian.com/software/jira/docs/api/9.8.1/com/atlassian/jira/bc/filter/DefaultSearchRequestService.html

 

The error listed in your picture is from passing DelegatingApplicationUser instead of ApplicationUser that the function is expecting.

 

I hope this helps!

Like Anuradha Yadav likes this

@Anuradha Yadav 

Did you have success using ScriptRunner to bulk delete filters?

I'm working on a project where I need to delete all the inactive users's filters or delete them by their filter id.

Suggest an answer

Log in or Sign up to answer