Hi i need to calculate the time the issues is in specific issue type using a scripted field.
any suggestion regarding this ?
Hi,
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.history.ChangeItemBeandef changeHistoryManager = ComponentAccessor.getChangeHistoryManager()def inProgressName = "Bug"List<Long> rt = [0L]def changeItems = changeHistoryManager.getChangeItemsForField(issue, "issuetype")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 Longreturn (total / 1000) as long ?: 0L
And let me know if that solves the issue, please share the answer if already been resolved.
Regards,
Anzar
It looks like you're new here. Sign in or register to get started.