Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Calling reindex in groovy script listener silently stops all script Edited


I have a script field ADir Due Date that is being inherited (copied) from linked issues with link type "is parent of" field Due Date and works fine.

When Due Date in the parent issue gets changed, the new ADir Due Date in child issues is calculated and displayed correctly, but JQL ORDER BY ADir Due Date starts to sort wrong. My guess was that child issues need to be reindexed, because reIndexing project in the administration menu helped. So I wrote this script, which works on issue update (modified to try in console):

import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.issue.IssueFieldConstants
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.index.IssueIndexingParams
import com.atlassian.jira.issue.index.IssueIndexingService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.util.ImportUtils
import org.apache.log4j.Logger

Logger log = log as Logger

def issue = ComponentAccessor.getIssueManager().getIssueObject("ADIRTECH-368");
def issueLinkManager = ComponentAccessor.getIssueLinkManager()

def hasLinkedIssues = issueLinkManager.getOutwardLinks( {issueLink ->
issueLink.issueLinkType.outward == "is parent task of"
log.error("hasLinkedIssues ${hasLinkedIssues}")

def issueMap = new HashSet<Issue>()

def action
def reindex = {Issue reindexingIssue ->
def added = issueMap.add(reindexingIssue);
if(added) {
log.error("Added issue to reindex ${reindexingIssue.key}")

action = {Issue currentIssue ->
log.error("Analyzing linked issues of ${currentIssue.key}")
issueLinkManager.getOutwardLinks( { issueLink ->
log.error("Analyzing issue ${issueLink.destinationObject.key}")
if(issueLink.issueLinkType.outward == "is parent task of") {
def destinationIssue = issueLink.destinationObject
if(destinationIssue.projectObject.key == "ADIRTECH")
List<CustomField> allCustomFields = ComponentAccessor.getCustomFieldManager().getCustomFieldObjects(destinationIssue)
def hasADirDueDate = allCustomFields.any { customField -> == "ADir Due Date" }
log.error("has ADir Due Date ${hasADirDueDate}")
if(currentIssue != issue) {
currentIssue.subTaskObjects.each { subTask ->

boolean wasIndexing = ImportUtils.isIndexIssues()
log.error("step 1")
try {
catch(Exception exception){
log.error("error", exception)
log.error("step 2")
log.error("step 3")

The last thing i see in logs is:
2019-01-28 18:48:42,441 ERROR [runner.ScriptRunnerImpl]: step 1

The script silently stops when calling reIndex of any kind (reIndex, reIndexIssueObjects) with or without IssueIndexingParams

I have red some posts regarding reindex like:

Looks like I'm doing the same thing, but what am I doing wrong?
Any help is appreciated.

P.S. I'm using log.error because lower levels are configured to be not displayed.
P.P.S. issueMap is not empty, I also tried to pass single issue to reIndex method
P.P.P.S. When running this script on issue update, it shows no errors.

Running on Jira Server v7.12.3

1 answer

1 accepted

I have checked atlassian-jira.log and was able to see all expected log lines, so I guess it actually works, just stops logging anything past reIndex method call.

It looks like the script actually reindexes issues, because in the search they appear ordered as expected now..

I'm experiencing the same problem. Script works well, everything is processed and all logs are available in atlassian-jira.log. But debug logging stops as soon as reIndex(...) function is called. I test a single script in Script Console.

If I comment out the reindex function, all debug records keeps printing (just issues are not reindexed, ofc).

Jira: 7.3.6
ScriptRunner: 5.5.9

Really strange, I don't have any explanation for this yet.

Michail, were you able to find the cause for this and resolve it? Thanks.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

New Cloud Apps Roundup - Spring 2021

Atlassian's marketplace partners have had a very productive start to 2021! Since our last roundup, our developer community has added over 160 new cloud apps to the Atlassian Marketplace to help you...

202 views 3 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you