Deleting an issue
In this recipe, let us look at deleting an issue programmatically.
How to do it...
Let us assume that we have an existing issue object. For deletion as well, we will use the IssueService
class. Following are the steps to do it:
- Validate the delete operation on the issue using
IssueService
:DeleteValidationResult deleteValidationResult = issueService.validateDelete(user, issue.getId());
Here, the issue is the existing issue object that needs to be deleted.
- If
deleteValidationResult
is valid, invoke the delete operation:if (deleteValidationResult.isValid()) { ErrorCollection deleteErrors = issueService.delete(user, deleteValidationResult); }
- If the
deleteValidationResult
is invalid, ...
Get JIRA Development Cookbook - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.