Accessing the fields of an issue in a script
This document details how to access the details of issue objects, such as the one provided by the issue
variables, as well as Issue
objects returned by other methods such as getParentObject
()
, getEpic()
or getLinkedIssues()
. You can access them using the:
- Getters of the Issue interface methods that are native to Jira.
get("<field_name>" or "<field_id>")
method returns the value of a system or custom field of the Issue object. The return type depends on the field being accessed.getAsString("<field_name>" or "<field_id>")
method that returns the String representation of the value of the system or custom field, whenever possible.getRawValue("<field_name>" or "<field_id>")
method that returns an Option object instead of a String when applied on a field of Single select list or Radio buttons type.getAvailableOptions("<field_name>" or "<field_id>")
method that returns a collection of available options for the specified fieldgetRemoteLinks(<Application Name>)
method takes a String representing the target application (e.g. "jira", "confluence" etc) and returns aCollection<RemoteIssueLink>
objects.getAsJsonData("<field_name>" or "<field_id>")
method returns the value of the field as a JsonData object. The return type is a JSON-style version of the field, essentially a key-value Map.
where <field_name
> is the name of the field as displayed in the Field configuration and <field_id>
is the ID of the field as shown in Accessing the Jira Standard fields of an issue document. In the case of a custom field, it has the form customfield_xxxxx
, where xxxxx
is the custom field numerical ID, as seen in the URL when viewing or editing the field.
An issue has the following fields. Click on each to know how to access them: