The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

"IndexingFailureException: Indexing completed with 2 errors" after deleting linked issues

Shugyla Omirbay
April 16, 2023

Hi! 

So, I needed to write a script in the post function that will delete linked issues when the main issue goes into the Rejected status. And only those linked issues that are on the Open and To Do statuses are deleted.

I managed to write it, and now there is a problem. When the main issue goes to the Rejected status, this error appears

 

com.atlassian.jira.index.IndexingFailureException: Indexing completed with 2 errors

Tell me please, where did I go wrong?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Shugyla Omirbay
April 16, 2023
Here is my script
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.link.IssueLink;
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.event.type.EventDispatchOption

def links = ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getId())    
for( l in links) { // linked issues
    def statusId = l.getSourceObject().getStatusId()//  Id статусов линкованных задач
   
    //Изменение саммари тикетов  
    log.debug(l.getSourceObject())
    def linkedIssues = l.getSourceObject() as MutableIssue
    def oldSummary = linkedIssues.getSummary()
    linkedIssues.setSummary("Отмена выхода " + oldSummary);    //Новое саммари тикетов
    ApplicationUser user = ComponentAccessor.getUserManager().getUserByName("robot3000")

    ComponentAccessor.getIssueManager().updateIssue(user, linkedIssues, EventDispatchOption.ISSUE_UPDATED, false) //переименование линкованых тикетов
    log.debug("done " + linkedIssues)

    if ((statusId == "1") || (statusId == "10507")) //Если тикеты  в статусе Open или To Do
    {
        //Удаление тикетов
        def issueToDelete = l.getSourceObject() as MutableIssue
        log.debug("Open " + issueToDelete)

        def issueManager = ComponentAccessor.getIssueManager()
        //issueManager.deleteIssueNoEvent(issueToDelete)
        ComponentAccessor.getIssueManager().deleteIssue(user, issueToDelete, EventDispatchOption.ISSUE_DELETED, false) // Удаление линкованых тикетов
    }

}