We recently upgraded our Jira Server instance from 7.2.7 with Scriptrunner 5.4.28, and are now using Jira Server 8.13.3 with Scriptrunner 6.27.0.
I have a scripted post-function which deletes all subtasks of the current issue. This post function performed without any problems in the old instance. Since upgrading, it still works, but now it displays an indexing error.
com.atlassian.jira.index.IndexingFailureException: Indexing completed with 1 errors
The number of errors matches the number of subtasks it deleted. (1 subtask, 1 error. 5 subtasks, 5 errors.) There is a HUGE wall of log text following this line, which I will not bother to paste here.
The code I've been using for the post-function is:
import com.atlassian.jira.event.type.EventDispatchOption<br>// for JIRA v6.*<br>def user = ComponentAccessor.getJiraAuthenticationContext().user.directoryUser<br>// for JIRA v7.*<br>// def user = ComponentAccessor.getJiraAuthenticationContext().user<br>def issueManager = ComponentAccessor.getIssueManager()<br>// will return a Collection<Issue> with all the subtasks of the current issue<br>def subTasksList = issue.getSubTaskObjects()<br>for (subTask in subTasksList) {<br> // add a condition here if you DO NOT want to delete all the sub-tasks<br> issueManager.deleteIssue(user, subTask, EventDispatchOption.ISSUE_DELETED, false)<br>}import com.atlassian.jira.component.ComponentAccessor<br>
Are my errors showing up because I'm in a newer version of Jira, or because I'm using a newer version of Scriptrunner, or both?
Is there a newer version of this code that I can use which will properly perform the delete without the errors?