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

Post function plugin - how to log the changes in the history?

Eva
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.
July 12, 2011

Hi,

I have recently created a post-function plugin that will update a custom field of a linked-issue (not the current issue) using OrderableField.updateValue. While the plugin works as expected, I notice that the changes I made to this issue is not even log in the history or activity. Is there a way I can enforce it to log the changes?

Thanks in advance!

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Eva
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 29, 2011

Apparently, it takes more than few lines of codes to make a change in custom field and to show up on hisotry.

To show in history (assuming you have make the change with field.updateValue and issue.setUPdated()

try {
					IssueUpdateBean issueUpdateBean = new IssueUpdateBean( issueToBe.getGenericValue(),
							internalIssue.getGenericValue(),EventType.ISSUE_UPDATED_ID, currUser);
					issueUpdateBean.setComment(changeHolder.getComment());
					issueUpdateBean.setChangeItems(changeItemBeans);
					issueUpdateBean.setDispatchEvent(true);
					issueUpdateBean.setParams(EasyMap.build("eventsource",
							IssueEventSource.ACTION));
					componentManager.getIssueUpdater().doUpdate(issueUpdateBean, true);
				} catch (JiraException e) {
					log.warn(e.getMessage());
				}

1 vote
Alexander Evert
Contributor
July 12, 2011

You should create ChangeGroup, detailed explanation with examples you can find here: http://forums.atlassian.com/message.jspa?messageID=257372650

Eva
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.
July 12, 2011

From that post, I did use the ChangeIssueHolder as part of the updateValue function call.

field.updateValue(item, modIssue, newValue, new DefaultIssueChangeHolder());

Am I suppose to do set something than just create new instance of DefaultIssueChangeHolder?

Thanks again

Eva
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.
July 12, 2011

I also tried the changeholder and still not updated under history tab...i am running out of ideas.

IssueChangeHolder changeholder = new DefaultIssueChangeHolder();

changeholder.addChangeItem(new ChangeItemBean(ChangeItemBean.CUSTOM_FIELD, codStatus.getName(),newValue.getOldValue().toString(), newValue.getNewValue().toString()));

field.updateValue(item, modIssue, newValue, changeholder);

Vineela Durbha
Contributor
April 25, 2019

Hi @Eva8 

Were you able able to find solution for the above?

I am even facing the issue that history is not getting updated

0 votes
Radu Dumitriu
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 29, 2011

I think if you update it like this:

Map actionParams = EasyMap.build("issue", issue.getGenericValue(),
                                             "issueObject", issue,
                                             "remoteUser", authenticationContext.getLoggedInUser(), 
                                             "dispatchEvent", Boolean.FALSE);
CoreFactory.getActionDispatcher().execute(ActionNames.ISSUE_UPDATE, actionParams);

it will put your history automatically

TAGS
AUG Leaders

Atlassian Community Events