This page explains how to access the value of User-created custom fields of different field types using Groovy. You can access them using the getters of the Issue interface. However, accessing custom fields using the native Jira API can be much more complex, depending on the type of the custom field being accessed. Instead, it is easier to access the fields using the methods provided by JMWE. To understand how to write values into the writable custom fields see Raw value/text input for fields and Groovy expression input for fields.
...
Panel |
---|
|
Checkboxes / Multi-select list
|
Groups
Panel |
---|
|
Single-Group PickerMulti-level Cascading select
|
Panel |
---|
|
Multi |
Groups
Users
Panel |
---|
|
SingleMulti-User pickerGroup Picker |
Panel |
---|
|
Users
Versions
Panel |
---|
|
Single-version picker |
Panel |
---|
|
Multi-user version picker |
Text
Panel |
---|
|
Watchers Single-line text field typeDescription: A A field of the Watchers type is an array of objects. Each user is an object in itself Single-line text type is a string that represents a single-line text. - Accessing a field of Watchers field field of Single-line text field type: You can access a custom field of Watchers field type Single-line text type using any of the following getters of the Issue interface:
get("<Your custom field name>") or get("customfield_xxxxx") that returns a Collection <ApplicationUser> Example: Number of Watchers in the custom field Code Block |
---|
language | groovy |
---|
linenumbers | true |
---|
| issue.:
|
...
Panel |
---|
|
Single-version pickerMulti-line text field typeDescription: A field of SingleMulti-version picker line text type is an object a string that represents a versiona multi-line text. - Accessing a field of Single-Version picker Multi-line text field type: You can access a custom field of SingleMulti-version picker line text type using any of the following getters of the Issue interface:
get(" <Your Your custom field name>name") or get("customfield_xxxxx") that returns a Collection <Version> String Example: Release date Text of the selected version:field Code Block |
---|
language | groovy |
---|
linenumbers | true |
---|
| issue.get(" | <SingleVersionpickername>")?.last()?.getReleaseDate(
getAsString("
<Your Your custom field
name>name") or getAsString("customfield_xxxxx") that returns a String representing the name of the versiontext:
Example: Release date Text of the selected version:field Code Block |
---|
language | groovy |
---|
linenumbers | true |
---|
| issue.getAsString(" | <SingleVersionpickername>
|
Panel |
---|
|
Multi-version pickerRead-only text field typeDescription: A field of MultiRead-version picker type is an array of objects. Each version is an object in itselfonly text type is a string that represents a read-only text. - Accessing a field of Multi-version picker line text field type: You can access a custom field of MultiRead-version picker only text type using any of the following getters of the Issue interface:
get("<Your custom field name>") or get("customfield_xxxxx") that returns a Collection <Version> Example: Are the selected versions same as the Affects Version/s? Code Block |
---|
language | groovy |
---|
linenumbers | true |
---|
| issue.get("<Multi-Version picker field name>") == issue.get("versions") | Example: Release date of the last versionsthe Issue interface:
|
...
Date/Time picker
Panel |
---|
|
Single-line text field typeDate picker |
Panel |
---|
|
Multi-line text field typeDate time picker |
Others
Panel |
---|
|
Read-only text Numeric field type |
...
Panel |
---|
|
Date Project picker typeDescription: A field of Date of Project picker type is a Timestamp (Date) object is an object describing a project. - Access
Accessing a field of Date Project picker type: You can access a custom field of Date Project picker type using any of the following getters of the Issue interface:
|
Panel |
---|
|
Date time pickerURL field type |
...
Add-on provided custom fields
Checklist for Jira
Panel |
---|
|
Numeric fieldChecklist
Project picker typeDescription: A field of Project picker type is an object describing a project. Accessing a field of Project picker type: You can access a custom field of Project picker type using any of the following getters of the Issue interface:
|
Panel |
---|
|
|
Insight custom fields
Panel |
---|
|
URL field typeInsight Object/s |
Add-on provided custom fields
Checklist for Jira
Panel |
---|
|
ChecklistInsight Readonly Object/sDescription: A Field A field of the type Checklist, is an array of Check list items. Each selected ChecklistItem is an object in itselfInsight Readonly Object/s that displays Insight Object/s. Accessing a field of Checklist type Insight Readonly Object/s: You can access a custom field of Checklist type using any of the following getters of the Issue interface:get("<Your custom field name>") or get("customfield_xxxxx") that returns a Collection<ChecklistItem > Example: Name of the first ChecklistItem of a checklist field Code Block |
---|
language | groovy |
---|
linenumbers | true |
---|
| issue.get("<Checklist field name>").first().name |
Example: is a specific ChecklistItem selected? Code Block |
---|
| issue.get("<Checklist field name>")?.find{
it.name == "test"
}?.isChecked() |
Example: All mandatory ChecklistItem Code Block |
---|
| issue.get("<Checklist field name>")?.findAll{
it.mandatory == true
} |
Example: Print all the names of the ChecklistItems Code Block |
---|
| <% def count = 0
issue.get("<Checklist field name>").each() {
count++
print "Checklist Item " + count + ": " + it.name + "\n"
}
%> | getAsString("<Your custom field name>") or getAsStringthe Insight Readonly Object/s type using any of the following getters of the Issue interface:
|
Panel |
---|
|
Insight Referenced Object (single) |
Panel |
---|
|
Insight Referenced Object (multiple) |