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 either the methods native to Groovy or 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

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 jQuery Version

  • Field name: Capture for jQuery Version

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

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


Panel
borderStylesolid

Capture for JIRA

Browser

Operating System

  • Field name: Capture for JIRA BrowserOperating System

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

  • Accessing the Capture for JIRA Browser Operating System field: You  You can access the Capture for JIRA BrowserOperating System field using any of the following getters methods of the Issue interface: Browser that
    •  that returns a String
      • Example: Capture for JIRA

      Browser
      • Operating System field of the issue:

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


    • getAsString("Capture for JIRA
    Browser


Panel
borderStylesolid

Capture for JIRA

Document Mode

Screen Resolution

  • Field name: Capture for JIRA Document ModeScreen Resolution

  • Description: The Capture for JIRA Document Mode Screen Resolution field is a multi-line text field describing the document mode screen resolution of the page capturedcapture.

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


Panel
borderStylesolid

Capture for JIRA

jQuery Version

URL

  • Field name: Capture for jQuery VersionJIRA URL

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

  • Accessing the Capture for JIRA jQuery Version fieldURL fieldYou can access the Capture for JIRA jQuery VersionURL field using any of the following getters of the Issue interface:


Panel
borderStylesolid

Capture for JIRA

Operating System

User Agent

  • Field name: Capture for JIRA Operating SystemUser Agent

  • Description: The Capture for JIRA Operating system User agent field is a multi-line text field describing the operating system user agent of the page captured.

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


Panel
borderStylesolid
Capture for JIRA Screen Resolution

Raised during

  • Field name: Capture for JIRA Screen ResolutionRaised during

  • Description: The Capture for JIRA Screen Resolution Raised during field is a multi-line text field describing the screen resolution of the page capturestring representing the ID of the session the issue was raised in.

  • Accessing the Capture for Screen resolution field Raised during fieldYou can access the Capture for Screen ResolutionRaised during field using any of the following methods getters of the Issue interface:


Panel
borderStylesolid
Capture for JIRA URL

Test sessions

  • Field name: Capture for JIRA URLTest sessions

  • Description: The Capture for JIRA URL Test sessions field is a string representation of a multi-line text describing the URL of the page capturedrepresenting the ID's of the sessions the issue belongs to.

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


Panel
borderStylesolid
Capture for JIRA User Agent

Testing status

  • Field name: Capture for JIRA User AgentTesting status

  • Description: The Capture for JIRA User agent Testing status field is a multi-line text field describing the user agent of the page captured string representing the status of the all the sessions the issue belongs to.

  • Accessing the Capture for JIRA User Agent Testing status fieldYou can access the Capture for JIRA User AgentTesting status field using any of the following getters of the Issue interface:

Jira Software fields

Panel
borderStylesolid
Raised during

Epic Color

  • Field name: Raised duringEpic Color

  • Description: The Raised during field is a string representing the ID of the session the issue was raised inEpic Color field is a multi-line text field describing the color of the Epic.

  • Accessing the Raised during field Epic Color fieldYou can access the Raised duringEpic color field using any of the following getters of the Issue interface:


Panel
borderStylesolid
Test sessions
  • Field name: Test sessionsEpic Link

  • Description: The Test sessions Epic link field is a string an object representing the ID's Epic of the sessions the current issue belongs to.

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


Panel
borderStylesolid
Testing status

Epic Name

  • Field name: Testing statusEpic Name

  • Description: The Testing status Epic Name field is a string representing the status of the all the sessions the issue belongs tomulti-line text field describing the name of the Epic.

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

...



Panel
borderStylesolid

Epic

Color

Status

  • Field name: Epic ColorStatus

  • Description: The Epic Color Status field is a multi-line text field describing representing the color status of the Epic.

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


Panel
borderStylesolid
Epic Link

Rank

  • Field name: Epic LinkRank

  • Description: The Epic link  The Rank field is an object a string representing the Epic priority of the current issueissue at a more granular level than issue priorities in Jira.

  • Accessing the

    Epic Link

    Rank field:

     You

     You can access the

    Epic Link

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


Panel
borderStylesolid
Epic Name

Sprint

  • Field name: Epic NameSprint

  • Description: The Epic Name Sprint field is a multi-line text field describing the name of the Epiccollection of objects. Each object represents a Sprint.

  • Accessing the

    Epic Name

    Sprint fieldYou can access the

    Epic Name

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

    • get("

      Epic Name

      Sprint") or get("customfield_xxxxx")

       that returns a String
      Example: Epic Name field of the issue

       that returns a  Collection<Sprint>

      • Example: First active Sprint the issue belongs to:

        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("Epic NameSprint").each(){
          names += it.getName()
        }
        names.join(",")


    • getAsString("

      Epic Name

      Sprint") or getAsString("customfield_xxxxx") that returns a String with comma separated Sprint IDs

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

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



true
  • issue.get("Epic StatusStory Points") getAsString("Epic Status") or getAsStringor get("customfield_xxxxx") that  that returns a String Double
    • Example: Epic status field Story points of the issuestory:

  • Panel
    borderStylesolid
    Epic Status

    Story Points

    • Field name: Epic StatusStory Points

    • Description: The Epic Status Story Points field is a multi-line text field number representing the status of the Epicstory points.

    • Accessing the Epic Status Story Points fieldYou can access the Epic statusStory points field using any of the following getters of the Issue interface:
    Code Block
    languagegroovy
    linenumbers
    Code Block
    languagegroovy
    linenumberstrue
    issue.getAsStringget("Epic Status")
    Panel
    borderStylesolid

    Rank

    • Field name: Rank

    • DescriptionThe Rank field is a string representing the priority of the issue at a more granular level than issue priorities in JIRA.

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

      • get("Rank") or get
        • Story Points")


        • 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 LexoRank. String representing the Story points

        • Example:Rank Story points of the parent issue:

          Code Block
          languagegroovy
          linenumberstrue
          issue.getParentObjectgetAsString()?."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("

      Rank

      Approvals")

      getAsString("Rank"

      .getApprovals() or

      getAsString

      get("customfield_xxxxx")

       that returns a LexoRank.

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

      • Example:

        Rank of

        Approvals on the

        parent

        issue:

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



    issue.get("Sprint").find(){ it.getState() == "ACTIVE" }
    • Example: All the Sprint names the issue belongs to Names of all approvers who approved the issue:

    Panel
    borderStylesolid
    Sprint

    Approvers

    • Field name: SprintApprovers

    • Description: The Sprint Approvers field is a collection an array of objects. Each object represents a Sprintan ApplicationUser.

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

    getAsString("Sprint") or getAsString("customfield_xxxxx") that returns a String with comma separated Sprint IDs

    Example: Sprints the issue belongs to:

    Code Block
    languagegroovy
    linenumberstrue
    issue.getAsString("Sprint")
    Panel
    borderStylesolid

    Story Points

    • Field name: Story Points

    • Description: The Story Points field is a number representing the story points.

    • Accessing the Story Points fieldYou can access the Story points field using any of the following getters of the Issue interface:
      • get("Story Points") or get
        • .join(",")


      • getAsString("Approvers") or getAsString("customfield_xxxxx") that

        returns a Double

        returns a String with comma separated Approvers usernames:

        getAsString("Story Points") or getAsString
        • Example:Story points of the story Names of all approvers who approved the issue:

          Code Block
          languagegroovy
          linenumberstrue
          issue.get("Story Points")
      • Example: Increase the story points by 10:

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



    Panel
    borderStylesolid

    Customer Request Type

    • Field name: Customer Request Type

    • Description: The Customer Request Type field represents an object describing the information about the Service Desk used to create the ticket.

    • Accessing the Customer request type fieldYou can access the Customers Request Type field using any of the following getters of the Issue interface:
    • get("Customer Request Type") or get("customfield_xxxxx") that returns a String representing the Story points VpOrigin
    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
      • Example:

        Story points of the issue:
        Code Block
        languagegroovy
        linenumberstrue
        issue.getAsString("Story Points")

    JIRA Service Desk fields

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

    Code Block
    languagegroovy
    linenumberstrue
    if(issue.get("Approvals").getApprovals()) { issue.get("Approvals").getApprovals().first().getName() }
    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
    Approvers

    Organizations

    • Field name: ApproversOrganizations

    • Description: The Approvers Organizations field is represents an array of objects. Each object represents an ApplicationUser.Strings describing the Organizations the issue belongs to

    • Accessing the Approvers Organizations field: You  You can access the Approvers Organizations field using any of the following getters of the Issue interface:
    • get("ApproversOrganizations") or get("customfield_xxxxx") that  that returns a  Collection<ApplicationUserOrganization>:
      • Example:

        Names of all approvers who approved

        Number of Organizations the issue belongs to:

        Code Block
        def names = []
        issue.get("
        Approvers
        Organizations")?.
        each(){ names += it.getName() } names
        size()

        Names of the Organizations:

        Code Block
        issue.get("Organizations")?.join(",")


    • getAsString("

      Approvers

      Organizations") or getAsString("customfield_xxxxx")

       that

       that returns a

       

      String with comma separated Organization ID's:

      • Example: Names of

        all approvers who approved the issue

        Organizations:

        Code Block
        issue.getAsString("
        Approvers
        Organizations")



    Panel
    borderStylesolid
    Customer

    Request

    Type

    participants

    • Field name: Customer Request Typeparticipants

    • Description: The Customer Request Type field represents an object describing the information about the Service Desk used to create the ticketRequest Participants is an array of objects. Each object represents an ApplicationUser.

    • Accessing the Customer request type Request Participants fieldYou can access the Customers Request Type participants field using any of the following getters of the Issue interface:"Customer Request Type") or get("customfield_xxxxx") that returns VpOrigin
      • Example: Customer request type:"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?

          Code Block
          issue.get("
        Customer
        • Request 
        Type
        • participants")
        ?.getRequestTypeKey()
        • .find(){
            it.getName() == "JohnDoe"  
          }!=null


      • getAsString("

      Customer Type that
      •  that returns

      a
      • String with comma separated usernames:

        • Example:

        Customer request type
        • Name of all the participants:

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



    Panel
    borderStylesolid
    Organizations

    Satisfaction

    • Field name: OrganizationsSatisfaction

    • Description: The Organizations Satisfaction field represents is an array of Strings describing the Organizations the issue belongs toobject describing the request feedback in Service Desk requests.

    • Accessing the

      Organizations

      Satisfaction field:

       You

        You can access the

      Organizations

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

      Organizations) that returns a Collection<Organization>
      • Example: Number of Organizations the issue belongs to:

        Code Block
        issue.get("Organizations")?.size()

        Names of the Organizations:) that returns a RequestFeedbackCFValue

        • Example: Rating on the service

          Code Block
          issue.get("
        Organizations
        • Satisfaction")?.
        join
        • getRate(
        ","
        • )


      • getAsString("

      Organizations


    Panel
    borderStylesolid
    Request participants

    Satisfaction date

    • Field name: Request participantsSatisfaction date

    • Description: The Request Participants is an array of objects. Each object represents an ApplicationUserSatisfaction date field is a Timestamp representing the date of feedback provided by the customer.

    • Accessing the

      Request Participants

      Satisfaction date field:

       You

       You can access

      the Request participants field using

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

    To manipulate the date see here


    Panel
    borderStylesolid
    Satisfaction

    Time to resolution

    • Field name: SatisfactionTime to resolution

    • Description: The Satisfaction Time to resolution field is an object describing the request feedback in Service Desk requestsrepresenting a SLA value.

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

    Satisfaction date

    Panel
    borderStylesolid
    To manipulate the date see here
        • ).getData()?.getOngoingCycle()?.getBreached()


          Note

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


    Portfolio for Jira fields

    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
    • 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 SLA Value:

       a 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

    ...

    Panel
    borderStylesolid

    Team

    • Field name: Team

    • Description: The Team field is a string representing the ID of the tempo team.

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

    ...

    Panel
    borderStylesolid

    Tempo Account

    • Field name: Account

    • Description: The Tempo Account field is an object representing the Tempo account the issue belongs to:

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

    ...