Hello,
I'm using ScriptRunner to write a Script Job that fires off a custom email report at the same time every night. I'm utilizing the ChangeHistoryManager to look for issues that had their status updated since the start of the day.
This works:
changeHistoryManager.getChangeItemsForField(estimateUpdateResults.getIssues()[k], "status")
But when I look for changed Original Estimates since the start of the day, I can't find a syntax that works. This doesn't work:
changeHistoryManager.getChangeItemsForField(estimateUpdateResults.getIssues()[k], "time_original_estimate")
Can anyone offer assistance or perhaps offer another solution for looking at the history of the Original Estimate field? It is not a field that supports history searches out of the box.
Thanks!
Hi @jordank
I didn't know for sure ... and rather than just give you the answer .... let me share how I found out.
First I look at the available methods in ChangeHistoryManager.
I saw getChangeItemsWithFieldForIssues which returns a ChangeHistory. Looking at the list of methods for ChangeHistory, I saw changeItemBean which is the same class returned as getChangeItemsForField.
So I put all that together and ran this:
import com.atlassian.jira.component.ComponentAccessor
def im = ComponentAccessor.issueManager
def chm = ComponentAccessor.changeHistoryManager
def issue = im.getIssueObject('JSP-1922')
chm.getChangeItemsWithFieldsForIssues([issue],null).collect{
it.changeItemBeans.field
}
This showed me all the "field" values for all my changes on my issue. And since I had just changed the original estimate, the last value in the list was 'timeoriginalestimate'.
So I ran
chm.getChangeItemsForField(issue, 'timeoriginalestimate')
And got the values that you'd expect.
Hope that helps.
Just wanted to say "thank you" to @PD Sheehan I've been struggling with using these two ChangeHistoryManager functions - your response gave me exactly the examples I needed :-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.