Versions Compared

Key

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

This document lists the expected result of a Groovy expression that should be provided to set Jira Standard and Custom fields. The easiest is to use the "Expected Value" tab of the Groovy editor help system. It lists the possible expected values for the selected Field and Value Type. This is applicable in contexts where you set a field value or comment an issue or write a conditional Groovy script. Select the Field and Value Type as Set field value to Groovy expression. Click on Expected Value. The help editor displays the expected values for the selected field.

You might also want to look at Standard fieldsPredefined custom fields, and User-created custom fields to know how to access the fields of an issue object.

...

 Field Name

Expected input type

Expected input value

Example

Affects Version/s

String

String[]

Version

Collection<Version>

A Groovy expression that returns a:

  1. String representing the name or id of a version.
  2. String with comma separated values that represent the names or ids (id takes precedence over the name) of the versions
  3. An array of strings that represent the names or ids (id takes precedence over the name) of the versions
  4. Single version object
  5. Collection of version objects
  1. "1.0"
  2. "1.0,2.0"
  3. ["1.0","2.0"]
  4. On creating a Bug set its Affects Version/s to the most recently released version

  5. Set the Affects Version/s of the issue to Affects Version/s of all its linked issues
Assignee

String

ApplicationUser

A Groovy expression that returns a:

  1. String representing the username of a user
  2. ApplicationUser object
  1. "carter"
  2. Assign the issue to the Project lead, if the issue is unassigned on creation.
Components

String

String[]

ProjectComponent

Collection<ProjectComponent>

A Groovy expression that returns a:

  1. String representing the name or id of the component
  2. String with comma separated values that represent the names or ids (id takes precedence over the name) of the components
  3. An array of strings that represent the names or ids (id takes precedence over the name) of the components
  4. Single component object
  5. Collection of component objects
  1. On creating an issue, pick the component of the issue from a cascading field that carries the Main and Sub-components
  2. "C1,C2"
  3. ["C1","C2"]

  4. Set the Component/s of the issue to components whose lead is the current user
DescriptionString

A Groovy expression that returns a:

  1. String representing a single line text.
  2. String representing a multi-line text
  1. "Issue associated to TEST-121"
  2. "Issues:\nFirst issue\nSecond issue"

  3. On the creation of a sub-task add its summary to the description of its parent.

Due date

String

Timestamp

A Groovy expression that returns a:

  1. Set the due date to today's date

  2. Set the due date to issue created plus five days.
EnvironmentString

A Groovy expression that returns a:

  1. String representing a single line text
  2. String representing a multi-line text
  1. "QA"
  2. "1. QA\n2. Production"
Fix Version/s

String

String[]

Version

Collection<Version>

A Groovy expression that returns a:

  1. String representing the name or id of the version
  2. String with comma separated values that represent the names or ids (id takes precedence over the name) of the versions
  3. An array of strings that represent the names or ids (id takes precedence over the name) of the versions
  4. Single version object
  5. Collection of version objects
Issue type

String

Long

IssueType


Note

Use with caution!

Changing the issue type should only be done if the current and new issue types share the same workflow, or if the issue's Status exists in both the current and new workflow. Otherwise, the operaton will fail.

Also, when changing the issue type of the current issue, make sure to move the post-function below the "Set issue status to the linked status of the destination workflow step" built-in post-function.

A Groovy expression that returns a:

  1. String representing a valid issue type name
  2. Number representing a valid issue type ID
  3. IssueType object.
  1. "Bug"
  2. 10020
  3. issue.issuetype
Labels

String

Set<Label>

A Groovy expression that returns a:

  1. String representing a value
  2. String with space separated values
  3. An array of strings that represent values
  4. Set of labels
  1. "New"
  2. "KB How-to-do"
  3. ["KB","How-to-do"]
  4. issue.get("Custom labels field")
Original Estimate

Long

String

A Groovy expression that returns a

  1. Number in Long format representing the estimate in seconds
  2. Duration string
Priority

String

Priority

A Groovy expression that returns a:

  1. String representing the name or id of the priority
  2. Priority object
  1. "Blocker"
  2. Set the priority of the issue to Highest if the issue belongs to the "Customer Portal" component

  3. On the creation of a Story, change its priority to that of the Epic if the Epic's priority is lower than the current priority of the Story

Remaining Estimate

Long

String

A Groovy expression that returns a

  1. Number in Long format representing the estimate in seconds
  2. Duration string
  • 22400L
  • "22400"
  • issue.get("timespent")
  • "4w 2d 6h 40m"
Reporter

String

ApplicationUser

A Groovy expression that returns a:

  1. String representing the username of a user
  2. ApplicationUser object
  1. "carter"
  2. Assign a reopened issue to the last person who commented it.
Resolution

String

Resolution

A Groovy expression that returns a:

  1. String representing the name or id of the resolution
  2. Resolution object.
  1. "Done"
  2. Set with the resolution the Epic resolution.

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


Security level

String

Long

IssueSecurityLevel

A Groovy expression that returns a:

  1. String representing the name or id of the security level
  2. Number in Longformat representing the id of the security level
  3. Security level
  1. "QA" or "10000"

  2. 10000L

  3. Assign to the first security level of the project that can be set for an issue created in this project by the current user

SummaryString

A Groovy expression that returns a String representing a single line text

"Test of the web interface"

Time spent

Long

String

A Groovy expression that returns a

  1. Number in Long format representing the time spent in seconds
  2. Duration string
  1. 22400L
  2. "22400"
  3. "4w 2d 6h 40m
Votes

String

String[]

ApplicationUser

Collection<ApplicationUser>

A Groovy expression that returns a:

  1. String representing the username of a user
  2. String with comma separated values that represent the usernames of the users.
  3. An array of strings that represent the usernames of the users
  4. Single ApplicationUser object
  5. Collection of ApplicationUser objects
  1. "charlie"
  2. "charlie,carter"
  3. ["charlie","carter"]
Watchers

String

String[]

ApplicationUser

Collection<ApplicationUser>

A Groovy expression that returns a:

  1. String representing the username of a user
  2. String with comma separated values that represent the usernames of the users.
  3. An array of strings that represent the usernames of the users
  4. Single ApplicationUser object
  5. Collection of ApplicationUser objects
  1. "charlie"
  2. "charlie,carter"
  3. ["charlie","carter"]
  4. On the creation of a Story add the reporter of its Epic to the Watchers

...

 Field NameExpected input typeExpected input valueExamples
Approvers

String

String[]

ApplicationUser

Collection<ApplicationUser>

A Groovy expression that returns a:

  1. String representing the username of a user
  2. String with comma separated values that represent the usernames of the users
  3. An array of strings that represent the usernames of the users
  4. Single ApplicationUser object
  5. Collection of ApplicationUser objects
  1. "carter"
  2. "djohn,carter"
  3. ["djohn","carter"]
  4. [issue.get("assignee")]
  5. issue.get("Watchers")
Customer Request TypeString

A Groovy expression that returns a:

  • String representing the Customer Request Type name
  • String representing the Customer Request Type internal ID
  • "IT help"
  • "sd/desktoplaptopsupport"
Organizations

String

Set<String>

A Groovy expression that returns a:

  • String representing the name of an Organization
  • String representing the id of a Organizationan Organization
  • String with comma-separated values that represent the names of the Organizations
  • String with comma-separated values that represent the ids of the Organizations
  • An array of strings that represent the names of the Organizations
  • An array of strings that represent the ids of the Organizations
  • "Acme, Inc."
  • "1"
  • "Acme,Apple"
  • "1,33"
  • ["Acme, Inc.", "Apple"]
  • ["1","33"]
Request Participants

String

String[]

ApplicationUser

Collection<ApplicationUser>

A Groovy expression that returns a:

    1. String representing the username of a user
    2. String with comma separated values that represent the usernames of the users
    3. An array of strings that represent the usernames of the users
    4. Single ApplicationUser object
    5. Collection of ApplicationUser objects
  • "carter"
  • "jon,charlie"
  • ["carter","djohn"]
  • issue.get("assignee")

...