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

[JIRA] Storing custom field values in Groovy

Sameera Shaakunthala [inactive]
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.
January 28, 2014

I'm writing a Groovy post function for a workflow transition in JIRA. This script sets the value of a multi-user custom field (ArrayList). After calling 'setCustomFieldValue()', I call 'store()' to store the issue. But it doesn't store the changes. I checked the database as well.

However, if I call 'getCustomFieldValue()' after 'setCustomFieldValue()', I can print the changes into log. Thaty means 'setCustomFieldValue()' method has worked properly.

In another script we have, it sets security level field and calls 'store()' method. That one works perfectly.

Is there any other method provided to store custom field values?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Henning Tietgens
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.
January 29, 2014

You could use issueManager.updateIssue() for this. issue.store() only works for direct members of the issue object itself and custom fields doesn't belong to this.

Sameera Shaakunthala [inactive]
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.
January 29, 2014

Thank you.

I guess this will update all the modified fields, isn't it?

Henning Tietgens
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.
January 29, 2014

Yes, all fields.

1 vote
Sameera Shaakunthala [inactive]
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.
January 28, 2014

Found the answer here: http://stackoverflow.com/questions/8251892/how-do-i-save-a-value-into-a-custom-field-in-jira-programmatically

Following is an 'easy' way I'm using.

DefaultIssueChangeHolder issueChangeHolder = new DefaultIssueChangeHolder();

cf_object.updateValue(null, issue, new ModifiedValue(null, issue.getCustomFieldValue(cf_object)), issueChangeHolder);

TAGS
AUG Leaders

Atlassian Community Events