Using issue.get(<field_name>) in scripts
When you create a script (Groovy or BeanShell), for example in a condition for a post-function or in a Calculated Field, you can use issue.get(<field_name>)
 to get the value of an Issue field, where <field_name>
can be either the name of a JIRA standard field or the internal name of a custom field.
Custom Fields
In the case of a custom field, <field_name>
 has the form customfield_xxxxx
, where xxxxx is the custom field numerical ID, as seen in the URL when editing the field. Or, starting with JIRA Misc Custom Fields v1.6.2 or JIRA Misc Workflow Extensions v. 3.7.0, you can also use the "real name" of the custom field (as shown in the list of custom fields).
The type of the return value of issue.get(...) depends on the type of the custom field you are accessing. The following table shows the return type for standard custom field types (provided by JIRA):
Field Type | Return Type | Comments |
---|---|---|
Checkboxes | Collection<Option> | |
Date Picker | java.util.Date | |
Date Time Picker | java.util.Date | |
Labels | Set<Label> | |
Number Field | Double | |
Radio Buttons | String | |
Select List (cascading) | Map<String, Option> | The key in the map represents the field depth of the select list. A key of null is the first level, and a key of "1" (the string "1") is the second level select list. |
Select List (multiple choices) | Collection<Option> | |
Select List (single choice) | String | |
Text Field (multi line) | String | |
Text Field (single line) | String | |
URL Field | String | |
User Picker (single user) |
ApplicationUser (depending on JIRA version) |
A lot more custom field types might be available on your JIRA instance, based on the plugins you have installed. The following table shows the return type for the most common "advanced" custom field types:
Field Type | Return Type |
---|---|
Group Picker (multiple groups) | Collection <Group> |
Group Picker (single group) |
|
Project Picker (single project) | GenericValue or Project (depending on JIRA version) |
User Picker (multiple users) | Collection<User> or Collection<ApplicationUser> (depending on JIRA version) |
Version Picker (multiple versions) | Collection<Version> |
Version Picker (single version) | Version |
Standard Fields
In the case of standard fields, <field_name>
 can be one of the following strings:
field name | returns | description |
---|---|---|
attachment | Â the collection of attachments to the issue | |
versions | the Affects Version/s field | |
comment | a list of all comments for the issue | |
components | ||
fixVersions | ||
issuetype | ||
issuelinks | a list of all inward and outward links | |
workratio | ||
issuekey | ||
subtasks | ||
priority | ||
resolution | ||
status | ||
project | Project | |
security | security level ID | |
timeestimate | Long  | |
timeoriginalestimate | Long  | |
timespent | Long  | |
aggregatetimespent | Long  | |
aggregatetimeestimate | Long  | |
aggregatetimeoriginalestimate | Long  | |
assignee |
ApplicationUser (depending on JIRA version) | |
reporter |
ApplicationUser (depending on JIRA version) | |
description | String | |
environment | ||
summary | String | |
duedate | Timestamp | |
updated | Timestamp | |
created | Timestamp | |
resolutiondate | Timestamp | |
labels | Set<Label> | |
watches |
|
Related articles
Filter by label
There are no items with the selected labels at this time.