Get issue's field value by name

grundic
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.
June 10, 2012

Hello.

How can I programmatically get value of some standard field by name? For example, "assignee", or "description".

I know, that I can use

issue.getAssignee()

but I don't know exact field, I know it in runtime.

Thanks in advance.

3 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.
June 11, 2012

Try this.

CustomField cField = customFieldManager.getCustomFieldObjectByName("name");
String value = issue.getCustomFieldValue(cField);

grundic
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.
June 11, 2012

So, I can work with built in field (assignee, summary) as with custom fields via customFieldManager?

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.
June 11, 2012

I might have misunderstood but the above is for custom fields only. Everything else, you already know the methods right?

0 votes
grundic
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.
June 10, 2012

Yes, I'm writting a plugin. I have a field name as a String, also I got some issue. I want to get value of that field.

0 votes
Mizan
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.
June 10, 2012

are you writing a plugin ? did you mean issue creation/editing by runtime ?

Suggest an answer

Log in or Sign up to answer