Issue Component Field

Batuhan Kandiran October 2, 2012

Hi Everyone,

I want to set component/s field of issue when its created with groovy script.

the problem is here : inherited issue object is instance of Issue class.

i have to change it MutableIssue in order to use setComponents(Collection<GenericValue> args) method

i wrote

IssueFactory issueFactory = ComponentManager.getInstance().getIssueFactory();

MutableIssue mi = issueFactory.getIssue(issue.getGenericValue());

mi.setComponents(predefinedCollection);

it doesnt work could you help me ?

2 answers

0 votes
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.
October 2, 2012

The right way to update issues is to call IssueService.update method. It does validations, throws events etc.

Batuhan Kandiran October 4, 2012

Thank you

Vishwajeet and Jobin.

I resolved the problem.

0 votes
Vishwajeet Singh
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.
October 2, 2012

You need to call mi.store() after you set the components http://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/IssueImpl.html#store()

Suggest an answer

Log in or Sign up to answer