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

Storing Update to Customfield in a Plugin

Dalectric
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 4, 2011

What's the best method of storing an update to a JIRA customfield?

I'm using the following

customFieldName = "SRL Responsible";
customField = customFieldManager.getCustomFieldObjectByName(customFieldName);
modifiedValue = new ModifiedValue(parentIssue.getCustomFieldValue(customField), issueObject.getCustomFieldValue(customField));
customField.updateValue(null, parentIssue, modifiedValue, new DefaultIssueChangeHolder());

boolean imp = ImportUtils.isIndexIssues();
ImportUtils.setIndexIssues(true);
parentIssue.store();
ComponentManager.getInstance().getIndexManager().reIndex(parentIssue.getGenericValue());
ImportUtils.setIndexIssues(imp);

However this doesn't seem to apply the update immediately, and so when I try to read from this "updated" field in the same plugin I get the old value of the field returned.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Jobin Kuruvilla [Adaptavist]
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 4, 2011

This should update immediately. Probably you are trying with the old issueObject when you read it again? Try to get the updated issueObject using issueManager and see if it helps!

PS: you don't even need to do issue.store()!

Dalectric
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 4, 2011

Perfect your idea worked like a charm

I added the following line after all the update commands

parentIssue = ComponentManager.getInstance().getIssueManager().getIssueObject(issueId);

Jobin Kuruvilla [Adaptavist]
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 4, 2011

Glad it worked.. I have come across this before ;)

TAGS
AUG Leaders

Atlassian Community Events