I am working on analysis of Change Log of an Issues
and I got into a problem.
when I try to get the From or To of Story Points log item, I am getting null.\
Why is that? and How I overcome this problem?
I have this function utility I wrote to DEBUG the issue (narrow the problem)
and it is the only thing I am running
// The Main Code
// Quite Simple - Call the utility change_log_print_field
change_log_print_field (issue,"Story Points")
return
// end of Main code
// the utility
// its purpose is to print all the log history of a selected field to logger
// in this case of Story Points
int change_log_print_field (Issue current_issue,String field_name){
def HistoryOfCurrentIssue = ComponentAccessor.getChangeHistoryManager().getAllChangeItems(current_issue)
ChangeHistoryItem caught_change = null
int count = 0
for (change in HistoryOfCurrentIssue ) {
if(change.getField().toString().indexOf(field_name)>-1 )
{
count = count + 1
log.warn "change_log_print_field: Date:"+change.created+"// Field:"+change.getField()+"// Froms:"+change.getFroms()+"// Tos:"+change.getTos()+"// User"+change.getUserKey()
}
}
return count
}
This is a picture of a single Issue I tested from Jira issue History
as you can see there are values in to and froms
but in the logger this is what I get
a more focused pic of the logger
in the code, this is the class I am using to access the History Log
works fine for text but not for Story Points
Any Suggestion?
Other ways to Access History Log that works are welcome as well.
@Avi Bachar This should work. Please try and let us know.
int change_log_print_field (Issue current_issue,String field_name){
List<ChangeItemBean> allitems = ComponentAccessor.getChangeHistoryManager().getChangeItemsForField(issue, field_name);
def size = allitems.size();
if(size >=1){
for (int i = 0; i < size; i++){
ChangeItemBean x = allitems.get(i);
def oldValue = x.getFrom();
def newValue = x.getTo();
def timecreated = x.getCreated();
log.warn "Field " + field_name + " changed from " + oldValue + " to " + newValue + " on " + timecreated
}
}
return size;
}
Thanks
This actually works
And I am using it now
But it is strange that it doesn't work for
ChangeHistoryItem class
Which should be the preferred way
To work with history log
Cause it takes in consideration multi value field like sprints
Which the ChangeItemBean do not
Thanks any way for the solution
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.