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

Delete Issue with a workflow function

GS1337
Contributor
September 2, 2019

Hello,

 

i want to create a Workflow transission that deletes linked Issues of the Parent issue. I have script runner but i havnt found a function like that. Is this even possible ?

2 answers

1 accepted

1 vote
Answer accepted
Ilya Turov
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 2, 2019

If you really want to do it despite what @Joe Pitt had to say, look at IssueService component and it's methods

basically, you'd do something like this:

import com.atlassian.jira.component.ComponentAccessor

//finding the issue you want to delete

def issueService = ComponentAccessor.issueService
def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def deleteValidationResult = issueService.validateDelete(currentUser, issueToDeleteId)
if (!deleteValidationResult.isValid()) {
log.warn deleteValidationResult.errorCollection
} else {
issueService.delete(currentUser, deleteValidationResult)
}

but still, it's better to close that 2nd one with the 'Duplicate' resolution and remove a link if you want to have only one issue linked.

1 vote
Joe Pitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 2, 2019

Do not delete issues. When you delete it is GONE. Hardly a week goes by without someone wanting to restore an issue. Deleting issues will come back and bite you when it is the most inconvenient. I suggest closing with a resolution value of Deleted anything you want to delete. I implement a special transition only the project lead can execute and it requires filling in a reason field from a select list (such as entered in error, OBE, Duplicate, Other) and explanation text.
Deleting issues destroys historical data. Missing issue numbers will eventually cause a question about what it was and why was it deleted even if it was done properly. Missing data always brings in the question of people hiding something that may have looked bad.

The only viable way to restore an issue is to create a new instance of JIRA and restore a backup that has the issues. Then export them to a csv file and import them to your production instance. You will lose the history.

GS1337
Contributor
September 2, 2019

The User can create 2 Types of issues out of the Parent Issue, but he can only create 1. So when he creates the wrong one by accident i just want to delete the issue because its not relevant anymore. The issues i want to delete are only a clone of the parent issue anyway

Joe Pitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 2, 2019

Sooner or later someone will delete the wrong issue that you want back. I think it is a bad practice to delete anything from a tracking system. 

GS1337
Contributor
September 2, 2019

But since its only a clone of the parent issue it doesnt really matter. When u want it back all u need to do is one click. So is it possible to delete an issue with a workflow function?

Suggest an answer

Log in or Sign up to answer