Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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
borderStylesolid

Watchers field type

  • Description: A field of the Watchers type is an array of objects. Each user is an object in itself.

  • Accessing a field of Watchers field typeYou can access a custom field of Watchers field type using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Checklist

  • Description: A Field of the type Checklist, is an array of Check list items. Each selected ChecklistItem is an object in itself.

  • Accessing a field of Checklist type: 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
        languagegroovy
        linenumberstrue
        issue.get("Checklist field name").first().name


      • Example: is a specific ChecklistItem selected?

        Code Block
        languagegroovy
        issue.get("Checklist field name")?.find{
          it.name == "test"
        }?.isChecked()


      • Example: All mandatory ChecklistItem

        Code Block
        languagegroovy
        issue.get("Checklist field name")?.findAll{
          it.mandatory == true
        }


      • Example: Print all the names of the ChecklistItems

        Code Block
        languagegroovy
        <% def count = 0
        issue.get("Checklist field name").each() {
          count++
          print "Checklist Item " + count + ": " + it.name + "\n"
        }
        %>


    • getAsString("Your custom field name") or getAsString("customfield_xxxxx")that returns a String with comma separated ChecklistItem

      • Example: All Checklist item

        Code Block
        languagegroovy
        issue.getAsString("Checklist field name")


Insight custom fields

Panel
borderStylesolid

Insight Object/s

  • Description: A recommended Insight field of the type Insight Object/s that supports both single and multiple values.

  • Accessing a field of Insight 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
borderStylesolid

Insight Readonly Object/s

  • Description: A field of the type Insight Readonly Object/s that displays Insight Object/s.

  • Accessing a field of Insight Readonly Object/s: You can access a custom field of the Insight Readonly Object/s type using any of the following getters of the Issue interface:


Panel
borderStylesolid

Insight Referenced Object (single)

  • Description: A field of the type Insight Referenced Object (single) that connects Insight Object/s referenced from another Insight Custom Field.

  • Accessing a field of Insight Referenced Object (single): You can access a custom field of the Insight Referenced Object (single) type using any of the following getters of the Issue interface:


Panel
borderStylesolid

Insight Referenced Object (multiple)

  • Description: A field of the type Insight Referenced Object (multiple) that connects Insight Objects referenced from another Insight Custom Field.

  • Accessing a field of Insight Referenced Object (multiple): You can access a custom field of the Insight Referenced Object (multiple) type using any of the following getters of the Issue interface: