Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to store customfield value change to issue change history

diana grigorcaka June 10, 2012

1. How can I add customfield value change to the one changegroup entry (with status change) as currently depicted field changes in a separate entry

2. In the change History i see "Anonymous made changes". Wy is that?

My plugin changes the value of one customfield on transition. I need to change is visible in the change history together with status changes in one changegroup entry. How this can be achieved?

At present, use the following code:

DefaultIssueChangeHolder issueChangeHolder = new DefaultIssueChangeHolder();
final ModifiedValue modifiedValue = (ModifiedValue) modifiedFields.get(customField.getId());
//IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
customField.updateValue(fieldLayoutItem, issue, modifiedValue, issueChangeHolder);

ChangeItemBean changeItemBean = new ChangeItemBean(ChangeItemBean.CUSTOM_FIELD,
customField.getName(), 
        null,
                        (String) modifiedValue.getOldValue(),
                        null,
                        (String) modifiedValue.getNewValue()
        );
issueChangeHolder.addChangeItem(changeItemBean);

ChangeLogUtils.createChangeGroup(
                    null,
                    issue,                           
                    issue,                           
                    issueChangeHolder.getChangeItems(),
                    true
                    ); 

            issue.store();
            try {
                ManagerFactory.getIndexManager().reIndex(issue);
            } catch (IndexException ex) {
                Logger.getLogger(MyPlugin.class.getName()).log(Level.SEVERE, null, ex);
            }

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Renuka Patil July 10, 2012

Hi diana,

You have to add status entry as well as custom field value change in the same list of change item & create the change group of these change items.

You have to add status change value to your issueChangeHolder.

As in the method createChangeGroup , you are providing changeAuthor value as null. Therefore you can see "Anonymous made changes" in the change history.

I hope this will be useful to you!!

Regards,

Renu

TAGS
AUG Leaders

Atlassian Community Events