Hi, I wrote the below scripted field to track the number of changes to a field say 'Story Points'.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.model.ChangeGroup
import com.atlassian.jira.model.ChangeItem
import com.atlassian.jira.issue.history.ChangeItemBean
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def changeItems = changeHistoryManager.getChangeItemsForField(issue,'Story Points')
if (changeItems) {
return changeItems.size();
}
else{
return 0
}
This field is working as expected. i.e if the 'Story points' field is updated thrice then the scripted field will display '3' meaning the field has updated three times.
However, now I am trying to track the changes only when a Story is not in 'Draft' or 'In review' status.
For instance:
If the Story Points field is updated once when a Story is 'In Draft' status , twice during 'In Review' status and thrice during the 'In Progress' status then, the Scripted field should only display '3' instead of '6'.
Any suggestions to achieve this?
I think you'd have to get all the ChangeItems and interate over them, deducing what status the issue is in for each change in the Story Points
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.