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
Community Members
Community Events
Community Groups

Is there a flag that shows whether an issue has been deleted?

I'm using the Rest API to export all issues into our database. The problem is when an issue get's deleted there is no way of knowing that based on the issues export from the API. Is there a flag or someplace I should be looking to know which issues are deleted and which are not?

2 answers

Does anyone have a solution to this problem?

What problem?

How to know if the issue is deleted

You know an issue has been deleted when you can't see it any more.  You don't need a flag.

It's a bit like putting up a sign that says "please don't read this sign" - utterly pointless and tells you nothing more that you found out by not having the sign in the first place.

I'm analyzing the R&D teams. I do not know if an issue has been deleted, it is still visible in the database

Ok, that's great context in which we can try to give you a better answer, but it does open up other problem areas.

A flag for "issue deleted" tells you no more than "issue is not there any more",  If you think you need a record of deletion, then your approach to your analysis is wrong, you are going to get the wrong numbers out of it.

You've made "a rod for your own back" here.  The database is the worst possible way you can look at Jira data.  It's hard to read, not relational, non performant and can't tell you everything you might want to know because most of the logic is done in the application.  Stop doing it this way, you're getting the wrong answers.

If an issue is still visible in the database, then it has not been deleted

Could you explain what your "analysis" is looking for?  We can probably tell you how to do it easier, faster and more accurately, and coping with deleted issues properly if we knew what you are really looking for.

For example, I want to count all epics that are in the done status. Some epics we opened as tests are also done, so the calculation is incorrect. Issues that have been deleted should be excluded.

If an issue has been deleted, it can't be counted - it's not there any more.  So your query works fine without any deleted marker.  In fact it only works because you don't have a deletion flag.  This case proves the point that you don't want a deletion marker!

The query "issuetype = epic and status = done" answers that question, although you may want to add something to exclude Epics that were somehow flagged with the test flag.  Issues that have been deleted won't break your query.  They would if they had left some form of marker.

I created a dashboard in Tableau, but what has been deleted still exists in the database. If I create the test, I know what to exclude, but if a team deletes, I don't know.
(I have 43 teams)

If an issue has been deleted, then it is not in the database anymore.  Your team have not deleted the issue if you are still seeing it in the database.

I think your Tableau settings are broken (they almost always will be if you've connected it directly to the Jira database)

This is the problem. I still see deleted issues in the database even if they have been deleted. So I came up with the idea of creating an automation that will add 1 to the field when the issue is deleted. But it's not working

Again, the issues you are seeing have not been deleted.  If they are in the database, they are not deleted. 

Jira deletes the whole issue when a human hits the delete button, it kills the current issue record, the comments, the custom field data, links, the hierarchy records, the history and the rest. 

They are gone.  Rows in the database cease to exist. 

The data is not pining, it has passed on.  It is no more, it has ceased to be.  It has kickedthe bucket, shuffled off its mortal coil and joined the choir invisible.   It is an Ex-issue.  It is not there anymore.

Could you explain how you think these issues are being "deleted"?  (Because it isn't a delete).  Do you mean they are "archived"?  Or restricted away from general view?  Or moved into a project that most people can't see?  Or put into a status called "deleted"?

When I delete an issue I press delete.
But our DB saves all the records, it doesn't know what was deleted and what wasn't.

I can not think of another way to explain this.

If you delete an issue in Jira, it is deleted.  The data is removed from the database.

That's it.  There's nothing more I can explain about issue deletion.

The only thing I can say that is related is that whatever process you think is "delete", it is not.  It is something else.

To get any further with explaining this, we need to know what you are actually doing when you think you are deleting an issue.

There is another why to delete an issue?

I press this bottom ->

Screenshot 2022-09-05 184403.png

I have talk with BI they told me that the deleted issue cant be deleted from the DB, so I'm looking for a solution...

Your screenshot is too limited to see what you are doing.

If, however, it is the one from the "issue options" menu (not the workflow), then I'm afraid I have to tell you that your BI team are talking utter *******s. 

The delete from the tools menu destroys all the data in the database related to the issue.

Do you have an idea  how I can solve this?

Again, solve what?

There is no problem with Jira defined here. 

The original post is about doing something the wrong way because the people who built it don't know how Jira works.  The other problem we seem to be having is that people are not understanding that deleted issues are deleted.  Both of these problems are solved by having people understand that deleted issues are deleted.

0 votes

Nope.  Deleted issues are gone, completely.

Is there a reason that something like a deleted flag doesn't get passed through? It basically makes it so without doing a full refresh then these deleted issues actually stay in the database without ever getting updated or removed.

No, you deleted the issue, it's gone.  There's nothing to hang a flag on.

As you're taking data out of Jira, it's going to be up to you to work it out.

In almost all enterprise tools (salesforce, hubspot, etc) when records get deleted there is still a flag that persists within the database for that record such as deleted = TRUE or deleted_at = timestamp. I understand what you are saying with it being gone i just don't think that is the proper way to handle this type of thing. It should not be viewable within Jira but that would simply be a frontend distinction. Removing it completely from the API export creates all sorts of downstream effects for people who utilize the API to track issues.

Like Lilach Mohager likes this

You can see more information regarding the problem in the jira_issues Table Info & Attributes sections:

My thinking is there shouldn't need to be a workaround to handle something as basic as this.

It's inefficient and pointless.  If an issue is not there, it's been deleted.  Your "downstream tracking" is easy - work on the assumption that if it's not there, it's not there.

@Danny Brown You could write your own listener on PreDelete event and do with the deleted issue what you wish to do

Suggest an answer

Log in or Sign up to answer