Tracking the Time Taken for Each Workflow Transition

Venkata Prathyush Thummepalli November 5, 2018

mport com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.history.ChangeItemBean def changeHistoryManager = ComponentAccessor.getChangeHistoryManager() def inProgressName = "In Progress" 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 return (total / 1000) as long ?: 0

 

This gives me only Status moved to InProgress.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events