I am trying to find the Jira database table that stores a scriptrunner custom field. We are calculating the time an issue is in one of the statuses of the projects work flow. Below is the script that is running to calculate the amount of time in that status. I have the field in the customfield table but no values are in the customfieldvalue table.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.history.ChangeItemBean
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def inProgressName = "1: Gap Analysis Assessment"
List<Long> rt = [0L]
def changeItems = changeHistoryManager.getChangeItemsForField(issue, "status")
changeItems.reverse().each {ChangeItemBean item ->
def timeDiff = System.currentTimeMillis() - item.created.getTime()
if (item.fromString == inProgressName) {
rt << -timeDiff
}
if (item.toString == inProgressName){
rt << timeDiff
}
}
def total = rt.sum() as Long
if (total == 0) { return null}
else return (total / 1000) as long ?: 0L