Hi, I want to delete a filter using mysql query... Edited

Hi, I want to delete a filter using mysql query... Even though it is deleting from database then filter still shows in Favorite Filters. When I click on Admin clog and select delete it says it is already deleted and removed from the favorite lists. But I want that to happen automate this thing. How to resolve this issue.

// returns if there is a empty filtersql.eachRow("select * from searchrequest where reqcontent = ''") {row ->log.debug("Empty Filter Name: "+row.filtername)filternames.push((String)row.filtername)filtername_username.push((String)row.username)filterid.push((String)row.ID)}log.debug(filternames)log.debug(filtername_username)log.debug(filterid)

//executes if there is a emptyif(filternames.size()>0){ComponentManager componentManager = ComponentManager.getInstance()SMTPMailServer mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer()

1 answer

1 accepted

Directly modifying the SQL database while Jira is running is not advised. This is because there are a number of cached elements from the database that are loaded up when jira is started. For you to change the SQL database without Jira knowing about this is the reason for leaving this 'favorite filter' artifact around.

There are two possible ways to get around this:

Make SQL changes only when Jira is stopped. This way when Jira starts up it can cache that data correctly and accurately. (provided that your SQL query is the same way Jira would delete this information from the database)

Make these changes via the Jira REST API.

I would recommend using method #2, just because you don't have to stop Jira this way. You can see how to do this via the rest API in DELETE /rest/api/2/filter/{id}.

@DTS Infra Admin No you cannot. The REST API will only let you delete filters that either you created or that have been shared with you as an editor. Starting with Jira 7.12 there have been some expanded abilities for end users to quickly share their filters with other users to view and edit. More details in the Jira Software 7.12 release notes.

But for filters that have not been shared with other users, Jira is designed to keep those filters private. Even Jira admins aren't able to edit/manage these in the web UI nor via the REST API. There is an existing feature request over in https://jira.atlassian.com/browse/JRASERVER-41269 that requests that specific feature and has been looking like it might actually get more attention in the near future.

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

This approach requires you to have the JIRA administrative rights. The main aim of this article is to help you achieve an organized, easy-to-maintain workflows in your JIRA instance thereby, reducin...