Can not get to run a Post Function script to reindex issue using groovy script

Karl Shlayfman June 14, 2012

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.

1 answer

0 votes
Jeff Turner August 16, 2012

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);

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events