I am trying to execute the same reindex script that I am able to run through Run Scripts but in the Workflow transiton in a Post Function.
I had a Groovy post-function that transitions linked issues. After transitioning a linked issue:
WorkflowUtils.actionIssue("", linkedIssue, TRANSITIONID, currentUser, [:])
I tried the usual reindex-an-issue code:
boolean wasIndexing = ImportUtils.isIndexIssues(); ImportUtils.setIndexIssues(true); indexManager.reIndex(linkedIssue) ImportUtils.setIndexIssues(wasIndexing);
But it didn't work.
Digging through FasttrackTransition.groovy source, I found that my 'linkedIssue' object that I transitioned had stale data, particularly the status. I had re-retrieve the Issue object, and then reindex that:
linkedIssue = componentManager.getIssueManager().getIssueObject(linkedIssue.id)
boolean wasIndexing = ImportUtils.isIndexIssues(); ImportUtils.setIndexIssues(true); indexManager.reIndex(linkedIssue) ImportUtils.setIndexIssues(wasIndexing);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.