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 |
---|
|
Multi-user picker
|
Users
Versions
Panel |
---|
|
Single-version picker |
Panel |
---|
|
Multi-version picker |
Text
Panel |
---|
|
Single-line text field type |
Panel |
---|
|
Watchers Multi-line text field typeDescription: A A field of the Watchers type is an array of objects. Each user is an object in itself. Accessing a field of Watchers field type: Multi-line text type is a string that represents a multi-line text. - Accessing a field of Multi-line text field type: You can access a custom field of Watchers field type Multi-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 <ApplicationUser> String Example: Number of Watchers in the custom field Code Block |
---|
language | groovy |
---|
linenumbers | true |
---|
| issue.get("<Your custom field name>").size() | Example: All the Watchers in the custom field except the Reporter Text of the field Code Block |
---|
language | groovy |
---|
linenumbers | true |
---|
| issue.get(" | <Yourcustomname>")?.findAll { it.getName() != issue.get("reporter").getName() }
getAsString("
<Your Your custom field
name>name") or
getAsString("customfield_xxxxx")
that returns String with comma separated Usernames.a String representing the text:
Example: All Watchers in Text of the custom field Code Block |
---|
language | groovy |
---|
linenumbers | true |
---|
| issue.getAsString(" | <YourcustomWatchers name>
|
...
Panel |
---|
|
Single-version pickerRead-only text field type |
Date/Time picker
Panel |
---|
|
Multi-version Date picker |
...
Panel |
---|
| Single-line text field type |
Date time picker |
Others
Panel |
---|
|
Multi-line text Numeric field type |
Panel |
---|
|
Read-only text field Project picker typeDescription: A field of Read-only text Project picker type is a string that represents a read-only textan object describing a project. Accessing a field of Multi-line text field Project picker type: You can access a custom field of Read-only text Project picker type using any of the following getters of the Issue interface:
|
...
Panel |
---|
|
Date pickerURL field type |
Add-on provided custom fields
Checklist for Jira
Panel |
---|
|
Date time pickerDescription: A field of Date time picker type is a Timestamp (Date) objectChecklist
|
Panel |
---|
|
Numeric field |
Others
Insight custom fields
Panel |
---|
|
Project picker typeInsight Object/sDescription: A A recommended Insight field of Project picker type is an object describing a projectthe type Insight Object/s that supports both single and multiple values. - 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:
get("<Your custom field name>") or get("customfield_xxxxx") that returns a Project
Example: Is the project same as the project the current issue belongs to? Code Block |
---|
language | groovy |
---|
linenumbers | true |
---|
| issue.get("<Project picker type field name>") == issue.get("project") | getAsString("<Your custom field name>") or getAsStringInsight object/s type: You can access a custom field of Insight object/s type using any of the following getters of the Issue interface:
|
Panel |
---|
|
URL field typeInsight Readonly Object/sDescription: A field of URL type is a string representation of an URLthe type Insight Readonly Object/s that displays Insight Object/s. - You
Accessing a field of URL type: Insight Readonly Object/s: You can access a custom field of Project picker type using the Insight Readonly Object/s type using any of the following getters of the Issue interface:get("<Your custom field name>") or get("customfield_xxxxx") that returns a String Example: URL value Code Block |
---|
language | groovy |
---|
linenumbers | true |
---|
| issue.get("<URL type field name>") | getAsString("<Your custom field name>") or getAsStringof the Issue interface:
|
Add-on provided custom fields
...
Panel |
---|
|
ChecklistInsight Referenced Object (single) |
Panel |
---|
|
Insight Referenced Object (multiple) |