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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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
4,557,735
Community Members
 
Community Events
184
Community Groups

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

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

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) // Удаление линкованых тикетов
    }

}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events