Versions Compared

Key

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

This page explains how to access the value of Standard Jira fields using Groovy. You can access them using getters of the Issue interface. 

In this page:

...

Panel
borderStylesolid

Affects Version/s

  • Field Name: Affects Version/s

  • Field ID: versions

  • Description: The Affects Version/s field is a collection of version objects. Each object represents a single version.

  • Accessing the Affects Version/s field: You can access the Affects Version/s field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Assignee

  • Field name: Assignee

  • Field ID: assignee

  • Description: The Assignee field is an object that represents the user who this issue is assigned to.

  • Accessing the Assignee field: You can access the Assigneefield using any of the following getters of the Issue interface:
    • getAssigneeUser() that returns an ApplicationUser
      • Example: EmailAddress of the user the issue is assigned to:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getAssigneeUser()?.getEmailAddress()


...

Panel
borderStylesolid

Attachments

  • Field name: Attachments

  • Field ID: attachment

  • Description: Attachment is a collection of objects. Each object represents a single attachment.

  • Accessing the Attachments field: You can access the Attachments field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Comments

  • Field name: Comment

  • Field ID: comment

  • Description: The Comments field is a collection of objects. Each object represents one comment.
  • Accessing the Comments field: You can access the Comments field using any of the following getters of the Issue interface:
    • get("comment") or get("Comments") that returns a List<Comment>
      • Example: Number of comments on the issue:

        Code Block
        languagegroovy
        linenumberstrue
        issue.get("comment").size()


      • Example: Last Comment body:

        Code Block
        languagegroovy
        linenumberstrue
        if(issue.get("comment"))
        {
          issue.get("comment").last().getBody()
        }


      • Example: Name of the author of the first comment on the issue:

        Code Block
        languagegroovy
        linenumberstrue
        if(issue.get("comment"))
        {
          issue.get("comment").first().getAuthorFullName()
        }


    • getAsString("Comments") or getAsString("comment") that returns a String with comma separated bodies of the comments:
      • Example: All the comments on the issue separated by a comma:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getAsString("comment")


...

Panel
borderStylesolid

Component/s

  • Field name: Component/s

  • Field ID: components

  • Description: The Component/s field is a collection of objects. Each object represents one component.

  • Accessing the Components fieldYou can access the Components field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Created

  • Field name: Created

  • Field ID: created

  • Description: The Created field is a Timestamp that represents the date-time of issue creation.

  • Accessing the Created field: You can access the Created field using any of the following getters of the Issue interface:

To manipulate the date see here

...

Panel
borderStylesolid

Creator

  • Field name: Creator

  • Field ID: creator

  • Description: The Creator field is an object that represents the user who created this issue.

  • Accessing the Creator field: You can access the Creator field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Description

  • Field name: Description

  • Field ID: description

  • Description: The Description field is a string representation of a multi-line text describing the issue.

  • Accessing the Description fieldYou can access the Description field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Due Date

  • Field name: Due Date

  • Field ID: duedate

  • Description: The Due Date field is Timestamp representing the due date of the issue.

  • Accessing the Due date field: You can access the Due date field using any of the following getters of the Issue interface:
    • getAsString("duedate") or getAsString("Due Date") that returns a String representing the Due date

      • Example: Due date of the issue:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getAsString("duedate")


    • getDueDate()that returns a Timestamp:

      • Example: Duedate plus five days. Note: to find out more about date manipulation in Groovy, see here.

        Code Block
        languagegroovy
        linenumberstrue
        if(issue.getDueDate())
        {
          issue.getDueDate() + 5
        }


...

Panel
borderStylesolid

Environment

  • Field name: Environment

  • Field ID: environment

  • Description: The Environment field is a string representation of a multi-line text describing the environment of the issue.

  • Accessing the Environment fieldYou can access the Environment field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Epic

  • Field name: Epic

  • Field ID: none

  • Description: Represents the issue's in the current Epic.

  • Accessing the Epic of an issue: You can access the Epic of an issue using the getEpic() that returns an Issue

    • Example: Get the Epic of the current issue

      Code Block
      languagegroovy
      linenumberstrue
      issue.epic


    • Example: Get the status of the current issue's Epic

      Code Block
      languagegroovy
      linenumberstrue
      issue.epic?.get("status")?.getName()


    • Example: Get the priority of the current issue's Epic

      Code Block
      languagegroovy
      linenumberstrue
      issue.getEpic()?.get("priority")?.getName()


...

Panel
borderStylesolid

FixVersion/s

  • Field name: Fix Version/s

  • Field ID: fixVersions
  • Description: The Fix Version/s field is a collection of objects. Each object represents a single version.

  • Accessing the Fix Version/s fieldYou can access the Fix Version/s field using any of the following getters of the Issue interface:
      • Example: Join the names of the Fix Version/s, separated by commas:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getFixVersions().join(",")


...

Panel
borderStylesolid
  • Field name: Issue Links

  • Field ID: issuelinks

  • Description: Issue links is a list of objects. Each object represents one issue link.

  • Accessing the Issue links fieldYou can access the Issue links field using any of the following getters of the Issue interface:

    • get("issuelinks") or get("Linked Issues") that returns a List<IssueLink>
      • Example: Get the issue links of the current issue

        Code Block
        languagegroovy
        linenumberstrue
        issue.get("issuelinks")


    • getInwardIssueLinks() that returns a List<IssueLink>
      • Example: Number of inward linked issues for the current issue

        Code Block
        languagegroovy
        linenumberstrue
        issue.getInwardIssueLinks().size()


    • getOutwardIssueLinks() that returns a List<IssueLink>
      • Example: Destination issue of the first issue link to the current issue

        Code Block
        languagegroovy
        linenumberstrue
        if(issue.getOutwardIssueLinks())
        {
          issue.getOutwardIssueLinks().first().getDestinationObject()  
        }


    • getLinkedIssues(String linkName) that returns a List<Issue>
      • Example: Get the issues linked to the current issue with the 'blocks' link type

        Code Block
        languagegroovy
        linenumberstrue
        issue.getLinkedIssues('blocks')


      • Example: Get the status of all issues linked to the current issue with the 'is blocked by' link type

        Code Block
        languagegroovy
        linenumberstrue
        Status = []
        issue.getLinkedIssues('is blocked by').each{
          Status += it.getStatus().getName()
        }
        return Status


...

Panel
borderStylesolid

Issue type

  • Field name: Issue Type

  • Field ID: issuetype

  • Description: The Issue Type field is an object describing the issue type.

  • Accessing the Issue type field: You can access the Issue type field using any of the following getters of the Issue interface:
    • getAsString("Issue Type") or getAsString("issuetype") that returns a String representing the name of the Issue Type.

      • Example: Name of the issue type:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getAsString("issuetype")


    • getIssueTypeObject() that returns an Issuetype

      • Example: Set a text field to "This issue is a sub-task" if the issue is a sub-task:

        Code Block
        languagegroovy
        linenumberstrue
        if(issue.getIssueTypeObject().getName()=="Sub-task")
        {
          "This is a sub-task"
        }


...

Panel
borderStylesolid

Key

  • Field name: Key

  • Field ID: issuekey

  • Description: The Key is a string that represents the key of the issue.

  • Accessing the Key of the issueYou can access the Key of the issue using any of the following getters of the Issue interface:
    • get("issuekey") or get("Key") that returns a String

      • Example: Access the key of the current issue:

        Code Block
        languagegroovy
        linenumberstrue
        issue.get("issuekey")


    • getAsString("Key") or getAsString("issuekey") that returns a String representing the key of the issue:

      • Example: Access the key of the current issue:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getAsString("issuekey")


    • getKey() that returns a String

      • Example: Access the key of the issue's Epic:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getEpic()?.getKey()


...

Panel
borderStylesolid

Labels

  • Field name: Labels

  • Field ID: labels

  • Description: Labels is a Set of labels.

  • Accessing the Labels field: You can access the Labels field using any of the following getters of the Issue interface:
    • get("labels") or get("Labels") that returns a Set<Label>
      • Example: Get the first label of the issue:

        Code Block
        languagegroovy
        linenumberstrue
        if(issue.get("labels"))
        {
        
          issue.get("labels").first()
        }


    • getAsString("Labels") or getAsString("labels") that returns a String with comma separated label names:

      • Examples: Labels of the issue

        Code Block
        languagegroovy
        linenumberstrue
        issue.getAsString("labels")


    • getLabels() that returns a Set<Label>

      • Example: Get the last label of the issue

        Code Block
        languagegroovy
        linenumberstrue
        if(issue.getLabels())
        {
          issue.getLabels().last()
        }


      • Example: All the labels of the issue separated by a comma:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getLabels().join(",")


...

Panel
borderStylesolid

Last Viewed

  • Field Name: Last Viewed

  • Field ID: lastViewed

  • Description: The Last Viewed field is a string representation of a date-timestamp.

  • Accessing the Last Viewed field: You can access the Last Viewed field using any of the following getters of the Issue interface:

To manipulate the date see here

...

Panel
borderStylesolid

Original Estimate

  • Field name: Original Estimate

  • Field ID: timeoriginalestimate

  • Description: The Original Estimate field is a duration string representing the original time estimate.

  • Accessing the Original Estimate fieldYou can access the Original Estimate field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Priority

  • Field name: Priority

  • Field ID: priority

  • Description: The Priority field is an object describing the priority of the issue.

  • Accessing the Priority fieldYou can access the Priority field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Progress

  • Field name: Progress

  • Field ID: progress

  • Description: The Progress field is a field describing the progress on the issue.

  • Accessing the Progress fieldYou can access the Progressfield using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Project

  • Field name: Project

  • Field ID: project

  • Description: The Project field is an object describing the selected project.

  • Accessing the Project fieldYou can access the Project field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Remaining Estimate

  • Field name: Remaining Estimate

  • Field ID: timeestimate

  • Description: The Remaining Estimate field is a number or a duration string representing the remaining time estimate in seconds.

  • Accessing the Remaining Estimate fieldYou can access the Remaining Estimate field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Reporter

  • Field name: Reporter

  • Field ID: reporter

  • Description: The Reporter field is an object that represents the user by whom the issue is reported.

  • Accessing the Reporter fieldYou can access the Reporter field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Resolution

  • Field name: Resolution

  • Field ID: reporter

  • Description: The Resolution field is an object describing the resolution of the issue.

  • Accessing the Resolution fieldYou can access the Resolution field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Resolved

  • Field name: Resolved

  • Field ID: resolutiondate

  • Description: The Resolved field is a Timestamp representing the resolution date.

  • Accessing the Resolved fieldYou can access the Resolved field using any of the following getters of the Issue interface:

To manipulate the date see here

...

Panel
borderStylesolid

Security Level

  • Field name: Security Level

  • Field ID: security

  • Description: The Security level field is an object describing the security level of the issue.

  • Accessing the Security level fieldYou can access the Security level field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Status

  • Field name: Status

  • Field ID: status

  • Description: The Status field is an object describing the status of the issue.

  • Accessing the Status fieldYou can access the Status field using any of the following getters of the Issue interface:
    • getAsString("Status") or getAsString("status") that returns a String representing the name of the status the issue is in:
      • Example: Name of the status of the issue:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getAsString("status")


    • getStatusObject() that returns a Status:
      • Example: Name of the status category of the status:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getStatusObject().getId()


...

Panel
borderStylesolid

Stories

  • Field name: Stories

  • Field ID: none

  • Description: Represents the issues in the current Epic.

  • Accessing the issues in an Epic: You can access the issues in an Epic using the getStories()that  that returns a List<Issue>

    • Example: Get the issues of an Epic that are in Closed status:

      Code Block
      languagegroovy
      linenumberstrue
      def stories = issue.getStories().findAll{
        it.get("status").getName() == "Closed"
      }
      return stories


    • Example: Get the number of issues in the current Epic

      Code Block
      languagegroovy
      linenumberstrue
      issue.getStories().size()


...

Panel
borderStylesolid

Subtasks

  • Field name: Sub-Tasks

  • Field ID: subtasks

  • DescriptionRepresents the subtasks of the current issue.

  • Accessing the Subtasks field: You can access the Subtasks field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Summary

  • Field name: Summary

  • Field ID: summary

  • Description: The Summary field is a string representation of a single-line text describing the summary of the issue.

  • Accessing the Summary field: You can access the Summary field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Time Spent

  • Field name: Time Spent

  • Field ID: timespent

  • Description: The Time spent field is a number representing the time spent on the issue in seconds.

  • Accessing the Time spent fieldYou can access the Time spent using any of the following getters of the Issue interface:
    • getAsString("Time Spent") or getAsString("timespent") that returns a String representing the time spent in seconds.

      • Example: Time spent on the issue in seconds:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getAsString("timespent")


    • getTimeSpent() that returns the time spent in seconds in a Long format:

      • Example: Time spent on the issue in seconds:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getTimeSpent()


...

Panel
borderStylesolid

Updated

  • Field name: Updated

  • Field ID: updated

  • Description: The Updated field is a Timestamp representing the issue updated date-time.

  • Accessing the Updated fieldYou can access the Updated field using any of the following getters of the Issue interface:

To manipulate the date see here

...

Panel
borderStylesolid

Votes

  • Field name: Votes

  • Field ID:votes

  • Description: The Votes field is a collection of users who voted for issue.

  • Accessing the VotesYou can access the Votes field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Watchers

  • Field name: Watchers

  • Field ID: watches

  • Description: The Watchers field is a collection of users watching the issue.

  • Accessing the Watchers field: You can access the Watchers field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

Work log

  • Field name: Log Work

  • Field ID: worklog

  • Description: The Work log field is a list of worklogs logged on the issue.

  • Accessing the Worklog: You can access the Log Work field using the get("worklog") or get("Log Work") that returns a List<Worklog>

    • Example: Time spent on the last work logged

      Code Block
      languagegroovy
      linenumberstrue
      if(issue.get("Log Work"))
      {
        issue.get("Log Work").last().getTimeSpent()
      }


...

Panel
borderStylesolid

Work Ratio

  • Field name: Work Ratio

  • Key: workratio

  • Description: The Work Ratio field is a number representing the ratio of work done on the issue.

  • Accessing the Work Ratio fieldYou can access the Work ratio field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

∑ Original Estimate

  • Field name: Σ Original Estimate

  • Field ID: aggregatetimeoriginalestimate

  • Description: The aggregate original estimate field is a number representing the total original estimate of the issue and its sub-tasks if the issue has any.

  • Accessing the ∑ Original Estimate fieldYou can access the ∑ Original Estimate field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

∑ Remaining Estimate

  • Field name: Σ Remaining Estimate

  • Field ID: aggregatetimeestimate

  • Description: The aggregate remaining Estimate field is a number representing the total remaining estimate of the issue and its sub-tasks if the issue has any.

  • Accessing the ∑ Remaining Estimate fieldYou can access the ∑ Remaining Estimate field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

∑ Progress

  • Field name: Σ Progress

  • Field ID: aggregateprogress

  • Description: The Aggregate Progress field is an object describing the aggregate progress on the issue.

  • Accessing the ∑ Progress fieldYou can access the ∑ Progress field using any of the following getters of the Issue interface:

...

Panel
borderStylesolid

∑ Time Spent

  • Field name: Σ Time Spent

  • Field ID: aggregatetimespent

  • Description: The Aggregate time spent field is a number representing the total time spent on the issue and its sub-tasks if the issue has any.

  • Accessing the ∑ Time spent fieldYou can access the ∑ Time spentfield using the

...