Versions Compared

Key

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

This page explains how to access the value of Pre-defined custom fields using Groovy. You can access them using the getters of the Issue interface. To understand how to write values into the writable custom fields see Raw value/text input for fields and Groovy expression input for fields

Note

'xxxxx' in the custom fields detailed below is the ID of the custom field. Click here to know how to find the ID of the custom fields.

...

Table of Contents

...

This page explains how to access the value of Pre-defined custom fields using Groovy. You can access them using the getters of the Issue interface. To understand how to write values into the writable custom fields see Raw value/text input for fields and Groovy expression input for fields

Note

'xxxxx' in the custom fields detailed below is the ID of the custom field. Click here to know how to find the ID of the custom fields.


In this page:

Table of Contents

Capture for JIRA fields

Panel
borderStylesolid

Capture for JIRA Browser

  • Field name: Capture for JIRA Browser

  • Description: The Capture for JIRA Browser field is a multi-line text field describing the browser of the page captured.

  • Accessing the Capture for JIRA Browser field: You can access the Capture for JIRA Browser field using any of the following getters of the Issue interface:
  • get("Capture for JIRA Browser") or get("customfield_xxxxx") that returns a String
    • Example: Capture for JIRA Browser field of the issue:

      Code Block
      languagegroovy
      linenumberstrue
      issue.get("Capture for JIRA Browser")


  • getAsString("Capture for JIRA Browser") or getAsString("customfield_xxxxx") that returns a String representing the browser of the page captured:

    • Example: Capture for JIRA Browser field of the issue:

      Code Block
      languagegroovy
      linenumberstrue
      issue.getAsString("Capture for JIRA Browser")



Panel
borderStylesolid

Capture for JIRA Document Mode

  • Field name: Capture for JIRA Document Mode

  • Description: The Capture for JIRA Document Mode field is a multi-line text field describing the document mode of the page captured.

  • Accessing the Capture for JIRA Document Mode fieldYou can access the Capture for JIRA Document Mode field using any of the following methods of Issue interface:


Panel
borderStylesolid

Capture for JIRA

Browser

jQuery Version

  • Field name: Capture for JIRA BrowserjQuery Version

  • Description: The Capture for JIRA Browser jQuery Version field is a multi-line text field describing the browser jQuery version of the page captured.

  • Accessing the Capture for JIRA Browser jQuery Version field: You  You can access the Capture for JIRA BrowserjQuery Version field using any of the following getters of the Issue interface: Browser that
    •  that returns a String
      • Example: Capture for JIRA

      Browser
      • jQuery Version field of the issue:

        Code Block
        languagegroovy
        linenumberstrue
        issue.get("Capture for JIRA 
      Browser
      • jQuery Version")


    • getAsString("Capture for JIRA
    Browser browser
    • jQuery version of the page captured:
      • Example: Capture for JIRA

      Browser
      • jQuery Version field of the issue:

        Code Block
        languagegroovy
        linenumberstrue
        issue.getAsString("Capture for JIRA 
      Browser
      • jQuery Version")



Panel
borderStylesolid

Capture for JIRA

Document Mode

Operating System

  • Field name: Capture for JIRA Document ModeOperating System

  • Description: The Capture for JIRA Document Mode Operating system field is a multi-line text field describing the document mode operating system of the page captured.

  • Accessing the Capture for JIRA Document Mode fieldOperating System fieldYou can access the Capture for JIRA Document ModeOperating System field using any of the following methods of Issue interface:


Panel
borderStylesolid

Capture for JIRA

jQuery Version

Screen Resolution

  • Field name: Capture for jQuery VersionJIRA Screen Resolution

  • Description: The Capture for JIRA jQuery Version Screen Resolution field is a multi-line text field describing the jQuery version screen resolution of the page capturedcapture.

  • Accessing the Capture for JIRA jQuery Version fieldScreen resolution fieldYou can access the Capture for JIRA jQuery VersionScreen Resolution field using any of the following getters methods of the Issue interface:


Panel
borderStylesolid

Capture for JIRA

Operating System

URL

  • Field name: Capture for JIRA Operating SystemURL

  • Description: The Capture for JIRA Operating system URL field is a multistring representation of a multi-line text field describing the operating system URL of the page captured.

  • Accessing the Capture for JIRA Operating System fieldURL fieldYou can access the Capture for JIRA Operating SystemURL field using any of the following methods getters of the Issue interface:


Panel
borderStylesolid

Capture for JIRA

Screen Resolution

User Agent

  • Field name: Capture for JIRA Screen ResolutionUser Agent

  • Description: The Capture for JIRA Screen Resolution User agent field is a multi-line text field describing the screen resolution user agent of the page capturecaptured.

  • Accessing the Capture for Screen resolution fieldJIRA User Agent fieldYou can access the Capture for Screen ResolutionJIRA User Agent field using any of the following methods getters of the Issue interface:


Panel
borderStylesolid
Capture for JIRA URL

Raised during

  • Field name: Capture for JIRA URLRaised during

  • Description: The Capture for JIRA URL Raised during field is a string representation of a multi-line text describing the URL of the page capturedrepresenting the ID of the session the issue was raised in.

  • Accessing the Capture for JIRA URL field Raised during fieldYou can access the Capture for JIRA URLRaised during field using any of the following getters of the Issue interface:


Panel
borderStylesolid
Capture for JIRA User Agent

Test sessions

  • Field name: Capture for JIRA User AgentTest sessions

  • Description: The Capture for JIRA User agent Test sessions field is a multi-line text field describing the user agent of the page capturedstring representing the ID's of the sessions the issue belongs to.

  • Accessing the Capture for JIRA User Agent Test Sessions fieldYou can access the Capture for JIRA User AgentTest Sessions field using any of the following getters of the Issue interface:


Panel
borderStylesolid
Raised during

Testing status

  • Field name: Raised duringTesting status

  • Description: The Raised during Testing status field is a string representing the ID status of the session all the sessions the issue was raised inbelongs to.

  • Accessing the Raised during Testing status fieldYou can access the Raised duringTesting status field using any of the following getters of the Issue interface:

Jira Software fields

Panel
borderStylesolid
Test sessions

Epic Color

  • Field name: Test sessionsEpic Color

  • Description: The Test sessions Epic Color field is a string representing the ID's of the sessions the issue belongs tomulti-line text field describing the color of the Epic.

  • Accessing the Test Sessions field Epic Color fieldYou can access the Test SessionsEpic color field using any of the following getters of the Issue interface:


Panel
borderStylesolid
Testing status
  • Field name: Testing statusEpic Link

  • Description: The Testing status Epic link field is a string an object representing the status Epic of the all the sessions the issue belongs tocurrent issue.

  • Accessing the Testing status field Epic Link fieldYou can access the Testing status field Epic Link using any of the following getters of the Issue interface:

Jira Software fields



Panel
borderStylesolid

Epic

Color

Name

  • Field name: Epic ColorName

  • Description: The Epic Color Name field is a multi-line text field describing the color name of the Epic.

  • Accessing the Epic ColorName fieldYou can access the Epic colorName field using any of the following getters of the Issue interface:


Panel
borderStylesolid

Epic

Link

Status

  • Field name: Epic LinkStatus

  • Description: The Epic link field is an object Status field is a multi-line text field representing the Epic status of the current issueEpic.

  • Accessing the Epic LinkStatus fieldYou can access the Epic Linkstatus field using any of the following getters of the Issue interface:


Panel
borderStylesolid
Epic Name

Rank

  • Field name: Epic NameRank

  • Description: The Epic Name  The Rank field is a multi-line text field describing the name of the Epicstring representing the priority of the issue at a more granular level than issue priorities in Jira.

  • Accessing the

    Epic Name

    Rank field:

     You

     You can access the

    Epic Name

    Rank field using any of the following getters of the Issue interface:


issue.get("Epic Status

Panel
borderStylesolid
Epic Status

Sprint

  • Field name: Epic StatusSprint

  • Description: The Epic Status Sprint field is a multi-line text field representing the status of the Epiccollection of objects. Each object represents a Sprint.

  • Accessing the

    Epic Status

    Sprint fieldYou can access the

    Epic status

    Sprint field using any of the following getters of the Issue interface:

    get("Epic Status") or get("customfield_xxxxx") that returns a String

    Example: Epic status field of the issue:

Code Block
languagegroovy
linenumberstrue
Code Block
languagegroovy
linenumberstrue
issue.get("Sprint").find(){
  it.getState() == "ACTIVE"
}


  • Example: All the Sprint names the issue belongs to:

    Code Block
    languagegroovy
    linenumberstrue
    def names = []
    issue.get("Sprint").each(){
      names += it.getName()
    }
    names.join(",")


  • getAsString("

    Epic Status

    Sprint") or getAsString("customfield_xxxxx") that returns a String

    representing the status of the Epic:

    with comma separated Sprint IDs

    • Example: Epic status field of Sprints the issue belongs to:

      Code Block
      languagegroovy
      linenumberstrue
      issue.getAsString("Epic StatusSprint")



  • Panel
    borderStylesolid
    Rank

    Story Points

    • Field name: RankStory Points

    • Description: The Rank  The Story Points field is a string number representing the priority of the issue at a more granular level than issue priorities in Jirastory points.

    • Accessing the Rank Story Points field: You  You can access the Rank Story points field using any of the following getters of the Issue interface:
    Panel
    borderStylesolid

    Sprint

    • Field name: Sprint

    • Description: The Sprint field is a collection of objects. Each object represents a Sprint.

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

        get("Sprint") or get
        • Example: Increase the story points by 10:

          Code Block
          languagegroovy
          linenumberstrue
          if(issue.get("Story Points"))
          {
            issue.get("Story Points") + 10
          }


      • getAsString("Story Points") or getAsString("customfield_xxxxx") that  that returns a  Collection<Sprint> String representing the Story points

        • Example:First active Sprint Story points of the issue belongs to:

          Code Block
          languagegroovy
          linenumberstrue
          issue.getgetAsString("Sprint").find(){
            it.getState() == "ACTIVE"
          }

          Example: All the Sprint names the issue belongs to:

          Code Block
          languagegroovy
          linenumberstrue
          def names = []
          issue.get("Sprint").each(){
            names += it.getName()
          }
          names.join(",")
        getAsString("Sprint") or getAsString
        • Story Points")


    Jira Service Desk fields

    Panel
    borderStylesolid

    Approvals

    • Field name: Approvals

    • Description: The Approvals field is a collection of objects. Each object represents an Approval.

    • Accessing the Approvals field: You can access the Approvals field using get("Approvals").getApprovals() or get("customfield_xxxxx"

      ) that returns a String with comma separated Sprint IDs

      ).getApprovals() method of the Issue interface that returns a Collection<Approval>

      • Example:

        Sprints

        Approvals on the issue

        belongs to

        :

        Code Block
        languagegroovy
        linenumberstrue
        if(issue.get("Approvals").getApprovals()) 
        {
          issue.
        getAsString
        get("
        Sprint
        Approvals").getApprovals().first().getName()
        }



    if(
  • Panel
    borderStylesolid
    Story Points

    Approvers

    • Field name: Story PointsApprovers

    • Description: The Story Points field is a number representing the story pointsApprovers field is an array of objects. Each object represents an ApplicationUser.

    • Accessing the Story Points Approvers fieldYou can access the Story points Approvers field using any of the following getters of the Issue interface:
    Code Block
    languagegroovy
    linenumberstrue
    def names = []
    issue.get("
    Story Points
    • Approvers").each()
  • { issue.get("Story Points") + 10 }
    • {
        names += it.getName()
      }
      names.join(",")


  • getAsString("Story PointsApprovers") or getAsString("customfield_xxxxx") that returns a String representing the Story points String with comma separated Approvers usernames:

    • Example: Story points of Names of all approvers who approved the issue:

      Code Block
      languagegroovy
      linenumberstrue
      issue.getAsString("Story PointsApprovers")
  • Jira Service Desk fields



    issue.getAsString("Approvers")
    Panel
    borderStylesolid
    Approvals

    Customer Request Type

    • Field name: ApprovalsCustomer Request Type

    • Description: The Approvals field is a collection of objects. Each object represents an ApprovalCustomer Request Type field represents an object describing the information about the Service Desk used to create the ticket.

    • Accessing the Approvals Customer request type field: You  You can access the Approvals Customers Request Type field using any of the following getters of the Issue interface:
    • get("ApprovalsCustomer Request Type") .getApprovals() or get("customfield_xxxxx").getApprovals() method of the Issue interface that returns a Collection<Approvals> that returns VpOrigin
      • Example:

        Approvals on the issue

        Customer request type:

        true
        Code Block
        languagegroovy
        linenumbers
        if(issue.get("ApprovalsCustomer Request Type")?.getApprovalsgetRequestTypeKey()) 
        {
          issue.get("Approvals").getApprovals().first().getName()
        }
    Panel
    borderStylesolid

    Approvers

    Code Block


  • getAsString("Customer Request Type") or getAsString("customfield_xxxxx") that returns a String representing the request type name:
    • Example: Customer request type:

      Code Block
      issue.getAsString("Customer Request Type")


  • To get the Customer Request Type name as displayed on the issue view, you can use the following snippet:

    Code Block
    languagegroovy
    linenumberstrue
    import com.atlassian.servicedesk.api.requesttype.RequestTypeService
    def requestTypeService = getComponent(RequestTypeService)
    def sourceIssueRequestTypeQuery = requestTypeService.newQueryBuilder().issue(issue.id).build()
    def requestTypeEither = requestTypeService.getRequestTypes(currentUser, sourceIssueRequestTypeQuery)
    if (requestTypeEither.isLeft()) {
            log.warn "${requestTypeEither.left().get()}"
            return false
        }
    return requestTypeEither.right.results[0].name



    Panel
    borderStylesolid
    Customer Request Type

    Organizations

    • Field name: Customer Request TypeOrganizations

    • Description: The Customer Request Type Organizations field represents an object array of Strings describing the information about the Service Desk used to create the ticket. Organizations the issue belongs to

    • Accessing the Customer request type Organizations field: You  You can access the Customers Request Type Organizations field using any of the following getters of the Issue interface:
    • get("Organizations") or get("customfield_xxxxx") that returns a Collection<Organization>
      • Example: Number of Organizations the

      Issue interface
      • issue belongs to:

        Code Block
        issue.get("
      Customer Request Type
      • Organizations")
      or get("customfield_xxxxx") that returns VpOrigin
      • Example: Customer request type:
        ?.size()

        Names of the Organizations:

        Code Block
        issue.get("Customer Request TypeOrganizations")?.getRequestTypeKeyjoin(",")


    • getAsString("

      Customer Request Type

      Organizations") or getAsString("customfield_xxxxx") that returns a String

      representing the request type name

      with comma separated Organization ID's:

      • Example:Customer request type Names of Organizations:

        Code Block
        issue.getAsString("Customer Request TypeOrganizations")



    • first participant:

    Panel
    borderStylesolid
    Organizations

    Request participants

    • Field name: OrganizationsRequest participants

    • Description: The Organizations field represents Request Participants is an array of Strings describing the Organizations the issue belongs toobjects. Each object represents an ApplicationUser.

    • Accessing the Organizations Request Participants field: You  You can access the Organizations Request participants field using any of the following getters of the Issue interface:Organizations that
      •  that returns
      a Organization
      • ApplicationUser>
        • Example:

        Number
        • Name of

        Organizations
        • the

        issue belongs to:
    Code Block
    Code Block
    if(issue.get("Request participants"))
    {
      issue.get("
    Organizations
    • Request participants")
    ?.size
    • .first().getName()
    Names of the Organizations:
    • 
      }


    • Example: is a specific user in the participants list?

      Code Block
      issue.get("
    Organizations
    • Request participants")
    ?.join(",")
    • .find(){
        it.getName() == "JohnDoe"  
      }!=null


  • getAsString("

  • Organizations that
    •  that returns

    a
    • String with comma separated

    Organization ID's
    • usernames:

      • Example:

      Names
      • Name of

      Organizations
      • all the participants:

        Code Block
        issue.getAsString("
      Organizations
      • Request participants")



    Panel
    borderStylesolid
    Request participants

    Satisfaction

    • Field name: Request participantsSatisfaction

    • Description: The Request Participants Satisfaction field is an array of objects. Each object represents an ApplicationUserobject describing the request feedback in Service Desk requests.

    • Accessing the

      Request Participants

      Satisfaction fieldYou can access the

      Request participants field using any of the following getters of the Issue interface:get("Request Participants") or get("customfield_xxxxx") that returnsCollection<ApplicationUser>

      Example: Name of the first participant:

      Code Block
      if(issue.get("Request participants"))
      {
        issue.get("Request participants").first().getName()
      }
      Example: is a specific user in the participants list?

      Satisfaction field using any of the following getters of the Issue interface:


    Panel
    borderStylesolid

    Satisfaction date

    • Field name: Satisfaction date

    • Description: The Satisfaction date field is an object describing the request feedback in Service Desk requestsa Timestamp representing the date of feedback provided by the customer.

    • Accessing the Satisfaction date field:

        You

       You can access

      the

      the Satisfaction

      field using

      date field using any of the following getters of the Issue interface:

    To manipulate the date see here


    Panel
    borderStylesolid
    Satisfaction date

    Time to resolution

    • Field name: Satisfaction dateTime to resolution

    • Description: The Satisfaction date Time to resolution field is a Timestamp representing the date of feedback provided by the customeran object representing a SLA value.

    • Accessing the

      Satisfaction date

      Time to resolution field: You can access the 

      Satisfaction date field using

      Time to resolution field using any of the following getters of the Issue interface:

    To manipulate the date see here

    Panel
    borderStylesolid

    Time to resolution

    • Field name: Time to resolution

    • Description: The Time to resolution field is an object representing a SLA value.

    • Accessing the Time to resolution field: You can access the Time to resolution field using any of the following getters of the Issue interface:

      • get("Time to resolution") or get("customfield_xxxxx") that returns a SLA Value:

        Example: Start time of the last completed cycle of the 'Time to first response' SLA:

        Code Block
        issue.get("Time to resolution")?.getLastCompletedCycle()?.get()?.getStartTime()
        getAsString("Time to resolution") or
        • resolution")


      • getAsJsonData("Time to resolution") or getAsJsonData("customfield_xxxxx") that returns the JSON version of the field being accessed.
        • Example: To check whether the Time to resolution SLA has been breached:

          Code Block
          issue.getAsJsonData("Time to resolution").getData()?.getOngoingCycle()?.getBreached()


          Note

          You can access any other SLA field in a similar way as shown above.


    Portfolio for Jira fields

    Panel
    borderStylesolid
    • Field Name: Parent Link
    • Description: The Parent link field is an object representing the Initiative of the current Epic. It returns com.atlassian.rm.jpo.env.issues.SimpleIssueAttributes.

    • Accessing the Parent Link fieldYou can access the Parent Link field using getAsString("Parent Link") or getAsString("customfield_xxxxx") that returns a

      String representing the SLA Value:

       String representing the key of the Initiative the Epic belongs to.

      • Example:

         Start time

         Fetch the issue object of the

        last completed cycle of the 'Time to first response' SLA

        Initiative the Epic belongs to:

        Code Block
        languagegroovy
        linenumberstrue
        def initiativeKey = issue.getAsString("
        Time to resolution")
        Parent Link");
        if (initiativeKey==null)
          return null;
        return com.atlassian.jira.component.ComponentAccessor.getIssueManager().getIssueObject(initiativeKey);


    Tempo fields

    Panel
    borderStylesolid

    Iteration

    ...