Issue Interface
This document details the methods you can use on any Issue
object, such as the one provided by the issue
, linkedIssue
and parentIssue
variables (where applicable), as well as Issue
objects returned by other methods such as getParentObject()
, getEpic()
or getLinkedIssues()
.
Methods of the Issue interface:
denotes a method that is specific to JMWE
On this page:
All methods of the Issue interface:
Methods to access issue fields and information
Method | Description | Parameters | Return type |
---|---|---|---|
get(String fieldNameOrID) | Returns the value of a system or custom field of the Issue object. | A string representing the field name or field Id |
|
get(String fieldNameOrID, Object defaultValue) | Returns the value of a system or custom field of the Issue object. If the value is null, it returns the default value specified as the second parameter. |
|
|
getAffectedVersions | Returns a collection of Affects Version/s objects, an empty collection if there are no affects versions. | None | |
getAssignee | Returns the Assignee user, null if the issue is not assigned. | None | |
getAsJsonData(String fieldNameOrID) | Returns the JSON-style version of a system or a custom field of the Issue object, essentially a key-value Map. This can be useful to access some complex Jira Software and Jira Service desk fields. | A string representing the field name or field Id | |
getAsString(String fieldNameOrID) | Same as the | A string representing the field name or field Id |
|
getAsString(String fieldNameOrID, String defaultValue) | Same as the |
|
|
getAttachments | Returns a collection of attachment objects, an empty collection if there are no attachments. | None | |
| Returns the channel through which the Jira Service Management request was created | None | |
getComponentObjects | Returns a collection of project components (as objects) that this issue is assigned to, an empty collection if there are no components. | None | |
getCreated | Returns the timestamp of the issue creation. | None | |
getCreator | Returns the user who created the issue. | None | |
getDescription | Returns the description of the issue, | None | |
getDueDate | Returns the due date of the issue, | None | |
getEnvironment | Returns the Environment of the issue, | None | |
getEstimate | Returns the "remaining estimate" of work left to be performed on this issue, in milliseconds, | None | |
getFixVersions | Returns a collection of Fix Version/s objects, an empty collection if there are no Fix versions. | None | |
getId | Returns the ID of the issue | None | |
getIssueTypeId | Returns the ID of the issue type of the issue. | None | |
getIssueType | Returns the issue type object of the issue | None | |
getKey | Returns the key of the issue | None | |
getLabels | Returns the labels of the issue, empty Set if no labels. | None | |
getNumber | Returns the issue number in the project | None | |
getOriginalEstimate | Returns the "original estimate" of work to be performed on this issue, in milliseconds, null if empty. | None | |
getPriorityObject | Returns the Priority for this Issue. | None | |
getProjectId | Returns the ID of the Project for this Issue. | None | |
getProjectObject | Returns the Project for this Issue. | None | |
getRawValue(String fieldNameOrID) | Same as the | A string representing the field name or field Id | Depends on the field being accessed |
getReporter | Returns the Reporter of the issue | None | |
getResolutionDate | Returns the timestamp of when an issue was resolved. Will be | None | |
getResolutionId | Returns the ID of the resolution of the issue, if any | None | |
getResolution | Returns the Resolution for this Issue, | None | |
getSecurityLevelId | Returns the Security level for this issue, | None | |
getStatus | Returns the status of the issue | None | |
getSummary | Returns the summary of the issue | None | |
getTimeSpent | Returns the "total time spent" working on this issue, in milliseconds, | None | |
getUpdated | Returns the timestamp of the issue update | None | |
getVotes | Returns the number of votes for the issue, | None | |
getWatches | Returns the number of watchers for the issue, | None | |
getWorkflowId | Returns the ID of the workflow the issue belongs to | None | |
isCreated | Returns true when the issue is created | None | |
isEditable | Returns true when the issue is editable | None | |
isSubTask | Returns true when the issue is a sub-task | None |
Methods to access issue's linked issues
Method | Description | Parameters | Return type |
---|---|---|---|
| Returns the Epic, if any, of the current issue. | None | |
| Returns a list of inward issue links to the issue, an empty list if there are no inward issue links. | None | |
| Returns a list of issue links from/to the current issue. This can be used to set the Linked Issues field | None | |
| Returns a list of issue links from/to the current issue with a specific link type. This can be used to set the Linked Issues field. |
| |
| Returns a list of issue links from/to the current issue with a specific link type and direction. This can be used to set the Linked Issues field. |
| |
| Returns a list of issues linked to the current issue (including the issue links being added on the transition screen during a transition) through any regular link type. Note: Supports all issue links other than Parent-Subtask (see | None | |
| Returns a list of issues linked to the current issue (including the issue links being added on the transition screen during a transition) through a specific link type. |
| |
| Returns a list of issues linked to the current issue (including the issue links being added on the transition screen during a transition) through the specified link type Id and direction. For example: |
| |
| Returns a list of outward issue links from the issue, an empty list if there are no outward issue links. | None | |
getParentObject | Returns the parent Issue, or null if the issue is not a subtask. | None | |
| Returns a list of issues linked to the current issue through the "is parent of (Portfolio child Issues)" link type | None | |
| Returns the issue linked to the current issue through the "is child of (Portfolio Parent Link)", or | None | |
getRemoteLinks(String ApplicationName) | Returns a collection of remote issue links of the current issue to the target application (e.g. "jira" or "confluence"). When the |
| |
| Returns a list of stories of the current Epic, an empty list if there are no Stories | None | |
getSubTaskObjects | Returns the subtasks of this issue, an empty collection if no subtasks | None |
Methods to link issues
Method | Description | Parameters | Return type |
---|---|---|---|
| Links the current issue to the specified issue through the specified link type direction |
|
|
| Links the current issue to the issue with the specified issue key through the specified link type direction |
|
|
| Links the current issue to the specified issue through the specified link type id and direction. |
|
|
| Links the current issue to the issue with the specified issue key through the specified link type id and direction. |
|
|
Methods to set issue field value
Method | Description | Parameters | Return type |
---|---|---|---|
setFieldValue(String fieldNameOrId, Object value) | Sets the value of a system or custom field of the Issue object |
|
|
Methods to access issue properties
Method | Description | Parameters | Return type |
---|---|---|---|
| Deletes the specified Entity property of the issue. |
|
|
| The value of the specified Entity property of the issue, parsed into a Groovy object. | A string representing the name of a property | |
| Sets the value of the specified Entity property of the issue to a JSON representation of the specified value. |
|
|
| Sets the value of the specified Entity property of the issue to the specified JSON string. |
|
|
Methods to display message on issue view
showMessageToUser(String type, Boolean autoClose, String title, String body)
Description
Displays a message to the user, in the form of a "flag" in the top right corner of the screen. Testing this in the Groovy tester will not display the flag.
Parameters
Parameter name | Type | Description | Example |
---|---|---|---|
| The type of message to display: info, success, warning or error. Controls the color of the message box. |
| |
| Whether the message box should close automatically after a few seconds. |
| |
| The title of the message | Sample title | |
| The body of the message. Can contain HTML markup |
|
Return type
void
Examples
1: Display a sample info message
Add the Scripted Groovy operation post-function to the transition
Input the following script
issue.showMessageToUser("info",true,"Sample message" , "Sample body" )
Save the post-function
Publish the workflow
Displays
2: Display a warning message to the users of the jira-administrators group
Add the Scripted Groovy operation post-function to the transition
Input the following script
if(currentUser.isInGroup("jira-administrators")){ issue.showMessageToUser("warning",true,"Warning message" , "Warning body" ) }
Save the post-function
Publish the workflow
Displays
showMessageToUser(String type, String title, String body, String actionName, String actionType, String actionParam, Boolean inNewWindow)
Description
Displays a message to the user, in the form of a "flag" in the top right corner of the screen. The message will include an action link which, when clicked, will navigate to either a Jira issue or an arbitrary web page. Testing this in the Groovy tester will not display the flag.
Parameters
Parameter name | Type | Description | Example |
---|---|---|---|
| The type of message to display: info, success, warning or error. Controls the color of the message box. |
| |
| The title of the message | Sample title | |
| The body of the message. Can contain HTML markup | Sample body | |
| The title of the action link | Go to issue | |
| The type of action to perform when the user clicks on the link. Can be GOTO_ISSUE to navigate to a Jira issue, or GOTO_URL to navigate to an arbitrary web page. |