Script runner does not work with scripted field properly after upgrade to JIRA 6.3


I am using a Scripted Field to count the number of times an issue has been reopened.

Name: Reopen Counter
Type: Scripted Field
Issue type(s): Global (all issues)

But after I upgraded from JIRA 6.2 to 6.3 - the value "Reopen Counter" is 0 for all issues. Neither does it increment the values for new issues. I have the latest version of the Script Runner plugin. 


The way "Reopen Counter" is scripted:

import com.atlassian.jira.ComponentManager
import groovy.sql.Sql
import java.sql.Connection
import org.ofbiz.core.entity.ConnectionFactory
import org.ofbiz.core.entity.DelegatorInterface
ComponentManager componentManager = ComponentManager.getInstance()
delegator = (DelegatorInterface) componentManager.getComponentInstanceOfType(DelegatorInterface.class)
String helperName = delegator.getGroupHelperName("default");
this.issueid =
def sqlStmt = """
	SELECT NEWSTRING AS Status, count(*) AS Number
	FROM changeitem, changegroup, jiraissue
	WHERE changeitem.field = 'Status'
		AND changeitem.groupid =
		AND changegroup.issueid =
		AND jiraissue.ID = ${this.issueid}
		AND changeitem.NEWSTRING = 'Reopened' 
Connection conn = ConnectionFactory.getConnection(helperName);
Sql sql = new Sql(conn)
row = sql.firstRow(sqlStmt)
if (row == null)
{ v = 0 }
{ v = row.Number }
d = (double)v
this.value = d


I hope that Jamie Echlin is going to help. 

1 answer

JIRA reindex - helped. 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

492 views 1 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you