Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scripted Field to display Original Estimate Change history

Matthew Beda
Contributor
October 11, 2018
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.history.ChangeItemBean
import com.atlassian.core.util.DateUtils 

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def string = "<table class='aui aui-table-list'><thead><tr><th>From</th><th>To</th><th>On Date</th></tr></thead><tbody>" 
List<Long> rt = [0L]
def origestimate = changeHistoryManager.getChangeItemsForField(issue, "timeoriginalestimate")
if (origestimate.size() <= 0){        
string = "N/A"    
} else {        
origestimate.each {
ChangeItemBean item ->
            
def totalf = item.fromString as Long            
def FROMSTRING = (totalf / 3600)            
def totalt = item.toString as Long            
def TOSTRING = (totalt / 3600)            
def createdDate = item.created.format('yyyy/MM/dd')            
string += "<tr class='aui-row-subtle'><td>"+ FROMSTRING + "h</td><td>"+ TOSTRING +"h</td><td>"+createdDate+"</td></tr>"         
}        
string += "</tbody></table>"             
}
return string

1 answer

1 accepted

0 votes
Answer accepted
Matthew Beda
Contributor
October 11, 2018

See above

Suggest an answer

Log in or Sign up to answer