Not seeing custom field values in .getFroms()

Scott Evans September 22, 2012

I have a Groovy custom listener in which I am trying to parse the history to see if a custom field (text type) has changed. The guts of the code I have looks like this:

def chiList = chm.getAllChangeItems(issue).reverse();

for (def chi in chiList) {

log.debug "Field is "+chi.getField()+" changed from "+chi.getFroms()+" to "+chi.getTos().toString()

}

What shows up in the log is:

Field is IP Version changed from [:] to {}

Field is IP Version changed from [:] to {}

Field is status changed from [1:Open] to {6=Closed}

I'm not seeing any values in getFroms or getTos maps. Can someone help me?

George

3 answers

1 accepted

0 votes
Answer accepted
Bhushan Nagaraj
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 24, 2012

George,

Why aren't you using the getChangeItemsForField method? I am guessing this should return a list of ChangeItemBean for a particular custom field too right? Or is it just for system fields?

def historyItemList = changeHistoryManager.getChangeItemsForField(issue, "status");

0 votes
Bhushan Nagaraj
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 24, 2012

changeHistoryManager.getAllChangeItems(Issue issue) returns a list of ChangeHistoryItem.

ChangeHistoryItem has the methods getFroms() and getTos()

http://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/changehistory/ChangeHistoryItem.html#getFroms()

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 24, 2012

Oh yeah. So what is chm? If you keep updating the field, do you get more and more debug lines? Can you post your entire code?

Scott Evans September 24, 2012

I have figure a different approach to my problem, but chm is below.

ComponentManager cm = ComponentManager.getInstance()

def chm = cm.getChangeHistoryManager()

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 24, 2012

What is getFroms and getTos? Are you thinking of getFromString() ?

Can you point to the javadoc for these methods...?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events