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.
...
Groups
Panel |
---|
|
Single-Group PickerMulti-level Cascading select
|
Panel |
---|
|
Multi |
Groups
Users
Panel |
---|
|
SingleMulti-User pickerGroup PickerMulti-user picker
- Description: A field of multi-user picker type is an array of objects. Each user is an object in itself
getAsStringSingleuserfield )
|
Panel |
---|
|
|
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 Multi-line text type is a string that represents a multi-line text. - Accessing a field of Watchers 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 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.
get("Your custom field name") .size()or get("customfield_xxxxx") that returns a String Example: All the Watchers in the custom field except the Reporter Text of the field Code Block |
---|
language | groovy |
---|
linenumbers | true |
---|
| issue.get(" | Yourcustom")?.findAll { it.getName() != issue.get(reporter".getName() }
getAsString("Your custom field 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(" | Your custom WatchersMulti-line text field name") |
|
Versions
Panel |
---|
|
Single-version pickerRead-only text field type |
Date/Time picker
Panel |
---|
|
Multi-version Date picker |
...
Panel |
---|
|
Single-line text field typeDate 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
|
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 Insight object/s 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 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:
|
Add-on provided custom fields
...
Panel |
---|
|
ChecklistInsight Referenced Object (single) |
Panel |
---|
|
Insight Referenced Object (multiple) |