interface Issue
Modifiers | Name | Description |
---|---|---|
static AttachmentCollectionType |
ATTACHMENT_COLLECTION_TYPE |
|
static IssueCollectionType |
ISSUE_COLLECTION_TYPE |
|
static IssueImplListType |
ISSUE_IMPL_LIST_TYPE |
|
static IssueLinkListType |
ISSUE_LINK_LIST_TYPE |
|
static ProjectComponentCollectionType |
PROJECT_COMPONENT_COLLECTION_TYPE |
|
static VersionCollectionType |
VERSION_COLLECTION_TYPE |
Type Params | Return Type | Name and description |
---|---|---|
|
abstract Comment |
addComment(java.lang.String body) Adds a comment to the issue. |
|
abstract Issue |
createSubTask(java.lang.String issueTypeName, groovy.lang.Closure<?> specification) Creates a sub-task of a given type for a provided issue, example usage: Issues.getByKey(SR-100).createSubTask('Sub-task') { summary = 'My sub-task } |
|
abstract void |
delete() Deletes the issue and any subtasks associated. |
|
abstract java.util.Collection<com.atlassian.jira.rest.clientv2.model.Version> |
getAffectedVersions() Gets the affected versions of the issue |
|
abstract User |
getAssignee() Gets the assignee |
|
abstract java.lang.String |
getAssigneeId() Gets the assignee id of the issue |
|
abstract User |
getAssigneeUser() Gets the assignee user |
|
abstract java.util.Collection<Attachment> |
getAttachments() Gets the collection of attachments associated with the issue. |
|
abstract java.util.Collection<Comment> |
getComments() Gets all the comments on an issue, example usage: Issues.getByKey('SR-100').getComments() |
|
abstract java.util.Collection<com.atlassian.jira.rest.clientv2.model.ProjectComponent> |
getComponentObjects() @Deprecated |
|
abstract java.util.Collection<com.atlassian.jira.rest.clientv2.model.ProjectComponent> |
getComponents() Gets the components of the issue |
|
abstract java.sql.Timestamp |
getCreated() Gets the issue created timestamp |
|
abstract User |
getCreator() Gets the creator of the issue |
|
abstract java.lang.String |
getCreatorId() Gets the creator ID of the issue |
|
abstract java.lang.Object |
getCustomFieldValue(java.lang.String customFieldName) Returns the custom field value for the field with the given name. |
|
abstract java.lang.Object |
getCustomFieldValue(java.lang.Long customFieldId) Gets the value of a custom field by its ID. |
|
abstract java.lang.String |
getDescription() Gets the description of the issue |
|
abstract java.sql.Timestamp |
getDueDate() Gets the due date of the issue |
|
abstract EntityProperties |
getEntityProperties() Retrieves the EntityProperties object associated with an issue. |
|
abstract java.lang.String |
getEnvironment() Gets the environment of the issue |
|
abstract Issue |
getEpic() Gets the epic issue that this issue is associated with. |
|
abstract java.lang.Long |
getEstimate() Gets the issue estimate number |
|
abstract java.util.Map<java.lang.String, java.lang.Object> |
getFields() |
|
abstract java.util.Collection<com.atlassian.jira.rest.clientv2.model.Version> |
getFixVersions() Gets the fix versions of the issue |
|
abstract java.lang.String |
getId() Gets the id of the issue as a String |
|
abstract java.util.List<com.atlassian.jira.rest.clientv2.model.IssueLink> |
getInwardLinks() Retrieves the list of inward links associated with the issue. |
|
abstract com.atlassian.jira.rest.clientv2.model.IssueTypeDetails |
getIssueType() Gets the issue type |
|
abstract java.lang.String |
getKey() Gets the key of the issue. |
|
abstract java.util.List<LabelLike> |
getLabels() Retrieves the list of labels associated with the issue. |
|
abstract java.util.List<com.atlassian.jira.rest.clientv2.model.IssueLink> |
getLinks() |
|
abstract java.util.Map<java.lang.String, java.lang.String> |
getNames() Gets the map of custom field IDs and their corresponding names. |
|
abstract java.lang.Long |
getNumber() Gets the id of the issue as a Long |
|
abstract java.lang.Long |
getOriginalEstimate() Gets the issue updated timestamp |
|
abstract java.util.List<com.atlassian.jira.rest.clientv2.model.IssueLink> |
getOutwardLinks() Retrieves the list of outward links associated with the issue. |
|
abstract java.lang.Long |
getParentId() Gets the ID of the parent issue |
|
abstract Issue |
getParentObject() Gets the parent issue object |
|
abstract com.atlassian.jira.rest.clientv2.model.Priority |
getPriority() Gets the priority of the issue |
|
abstract com.atlassian.jira.rest.clientv2.model.Priority |
getPriorityObject() |
|
abstract java.lang.Long |
getProjectId() Gets the ID of the project associated with the issue |
|
abstract com.atlassian.jira.rest.clientv2.model.Project |
getProjectObject() Gets the project object associated with the issue |
|
abstract User |
getReporter() Gets the reporter of the issue |
|
abstract java.lang.String |
getReporterId() Gets the reporter ID of the issue |
|
abstract User |
getReporterUser() Gets the reporter user object of the issue |
|
abstract com.atlassian.jira.rest.clientv2.model.Resolution |
getResolution() Gets the resolution of the issue |
|
abstract java.sql.Timestamp |
getResolutionDate() Gets the issue resolution date |
|
abstract java.lang.String |
getResolutionId() Gets the resolution ID of the issue |
|
abstract com.atlassian.jira.rest.clientv2.model.Resolution |
getResolutionObject() @deprecated |
|
abstract java.util.Map<java.lang.String, com.atlassian.jira.rest.clientv2.model.JsonTypeBean> |
getSchema() The schema describing each field present on the issue. |
|
abstract com.atlassian.jira.rest.clientv2.model.SecurityLevel |
getSecurityLevel() Gets the security level of the issue |
|
abstract java.lang.Long |
getSecurityLevelId() Gets the security level ID of the issue |
|
abstract java.lang.String |
getSelf() The URL of the issue's details. |
|
abstract com.atlassian.jira.rest.clientv2.model.Status |
getStatus() Gets the issue status |
|
abstract java.lang.String |
getStatusId() Gets the issue status ID |
|
abstract com.atlassian.jira.rest.clientv2.model.Status |
getStatusObject() @deprecated |
|
abstract IssueIterator |
getStories() Retrieves all the issues linked to the current issue. |
|
abstract java.util.Collection<Issue> |
getSubTaskObjects() Gets the collection of sub-task objects of the issue |
|
abstract java.util.List<Issue> |
getSubtasks() Gets the list of sub-tasks of the issue, example usage: |
|
abstract java.lang.String |
getSummary() Gets the summary of the issue |
|
abstract java.lang.Long |
getTimeSpent() Gets the time spent on the issue |
|
abstract java.util.List<com.atlassian.jira.rest.clientv2.model.IssueTransition> |
getTransitions() Gets the list of transitions available for the issue. |
|
abstract java.sql.Timestamp |
getUpdated() Gets the issue updated timestamp |
|
abstract java.lang.Long |
getVotes() Gets the number of votes for the issue |
|
abstract java.lang.Long |
getWatches() Gets the number of watches of the issue |
|
abstract boolean |
isCustomFieldInContext(java.lang.String customFieldName) |
|
abstract boolean |
isCustomFieldInContext(java.lang.Long customFieldId) |
|
abstract boolean |
isSubTask() Checks if the issue is a sub-task |
|
abstract void |
link(java.lang.String linkTypeName, Issue target) Links the issue to the target issue with the specified link type, example usage: Issues.getByKey('SR-100').link('blocks', Issues.getByKey('SR-200')) |
|
abstract void |
link(java.lang.String linkDirectionName, java.lang.String targetIssueKey) Links the issue to the target issue by a specified issue key with the specified link direction, example usage: Issues.getByKey('SR-100').link('blocks', "SR-200") |
|
abstract Issue |
refresh() Refreshes the issue to get the latest data. |
|
abstract Issue |
transition(java.lang.String transitionName) Transitions the issue using the specified transition name, example usage: Issues.getByKey(SR-100).transition('transition-name') |
|
abstract Issue |
transition(java.lang.String transitionName, groovy.lang.Closure<?> specification) Transitions the issue using the specified transition name and update specification, example usage: Issues.getByKey('SR-100').transition('Start Progress') { assignee = 'admin' transitionOptions { skipConditions() skipValidators() } } |
|
abstract void |
unlink(java.lang.String linkDirectionName, Issue target) Removes the link between the current issue and the target issue with the specified link type. |
|
abstract void |
unlink(java.lang.String linkTypeName, java.lang.String targetIssueKey) Removes the link between the current issue and the target issue with the specified link type and issue key. |
|
abstract Issue |
update(groovy.lang.Closure<?> specification) Updates the issue using the provided groovy.lang.Closure specification. |
Adds a comment to the issue.
This method allows you to add a comment to the issue's comment thread. The comment is stored as plain text and supports Jira's wiki markup for formatting. You can include formatting such as bold, italics, links, and bullet points using the supported wiki markup syntax.
Example Usage:
// Add a simple comment
issue.addComment("This is a new comment on the issue.");
// Add a comment with formatting
issue.addComment("Here is *bold text*, _italic text_, and [a link|https://example.com].");
// Add a multiline comment
issue.addComment("""
This is a multiline comment.
* Point 1
* Point 2
* Point 3
""");
body
- the body of the comment to add, as plain text or wiki markup-formatted stringCreates a sub-task of a given type for a provided issue, example usage:
Issues.getByKey(SR-100).createSubTask('Sub-task') { summary = 'My sub-task }
issueTypeName
- issue type name for the sub-taskspecification
- closure specifying parameters to be set on the created sub-taskDeletes the issue and any subtasks associated.
Gets the affected versions of the issue
Gets the assignee
Gets the assignee id of the issue
Gets the assignee user
Gets the collection of attachments associated with the issue.
Gets all the comments on an issue, example usage:
Issues.getByKey('SR-100').getComments()
@Deprecated
Gets the components of the issue
Gets the issue created timestamp
Gets the creator of the issue
Gets the creator ID of the issue
Returns the custom field value for the field with the given name. In the case of multiple fields with the same name, only those fields in the scope of this issue context are considered. If there are multiple custom fields with the same name associated with this issue context (this is unlikely, and inadvisable for multiple reasons), the first custom field created will be used.
customFieldName
- name (the untranslated name) of the custom fieldGets the value of a custom field by its ID.
customFieldId
- the ID of the custom field.Gets the description of the issue
Gets the due date of the issue
Retrieves the EntityProperties object associated with an issue.
Gets the environment of the issue
Gets the epic issue that this issue is associated with.
Gets the issue estimate number
Gets the fix versions of the issue
Gets the id of the issue as a String
Retrieves the list of inward links associated with the issue.
Inward links represent the relationships where the current issue acts as the target in a link type. For example, if another issue "blocks" the current issue, this method will return that link in the list. Each link is represented as an com.atlassian.jira.rest.clientv2.model.IssueLink, which provides details about the link type, the source issue, and the direction of the link.
Example Usage in Groovy:// Retrieve inward links for the issue
def issue = Issues.getByKey("TEST-123")
def inwardLinks = issue.getInwardLinks()
// Print details about each inward link
inwardLinks.each { link ->
println "Inward Link: ${link.type.name
from ${link.inwardIssue.key}"
}
}
Typical Use Case:
Gets the issue type
Gets the key of the issue.
Retrieves the list of labels associated with the issue.
Labels are user-defined tags that help categorize and organize issues in Jira. They are often used for filtering, reporting, grouping, and automation workflows within projects. The returned list contains LabelLike objects, which represent the label names.
This method is particularly useful in scenarios where labels need to be reused, copied to other issues, or used in bulk updates. For example, labels from one issue can be applied to linked issues or manipulated for reporting purposes.
Example 1: Retrieving and Printing Labels// Specify the issue by key
def issue = Issues.getByKey("TEST-123")
// Retrieve labels and print them
def labels = issue.getLabels()
labels.each { label ->
println "Label: ${label
"
}
}
Example 2: Copying Labels to Linked Issues
// Specify the issue by key
def issue = Issues.getByKey("TEST-9")
// Retrieve labels as an array of strings
String[] labels = issue.labels.collect { it.toString()
.toArray(new String[0])
// Apply labels to outward-linked issues
def successStatusByIssueKey = issue.getOutwardLinks().collect { linkedIssue ->
Issues.getByKey(linkedIssue.outwardIssue.key).update {
setLabels(labels)
}
linkedIssue.outwardIssue.key
}
// Output a message indicating the result
successStatusByIssueKey ? "Labels successfully copied to issues: ${successStatusByIssueKey}." :
"No outward links found. No labels copied."
}
Gets the map of custom field IDs and their corresponding names.
Gets the id of the issue as a Long
Gets the issue updated timestamp
Retrieves the list of outward links associated with the issue.
Outward links represent the relationships where the current issue acts as the source in a link type. For example, if the current issue "blocks" another issue, this method will return that link in the list. Each link is represented as an com.atlassian.jira.rest.clientv2.model.IssueLink, which provides details about the link type, the target issue, and the direction of the link.
Example Usage in Groovy:// Retrieve outward links for the issue
def issue = Issues.getByKey("TEST-123")
def outwardLinks = issue.getOutwardLinks()
// Print details about each outward link
outwardLinks.each { link ->
println "Outward Link: ${link.type.name
to ${link.outwardIssue.key}"
}
}
Typical Use Case:
Gets the ID of the parent issue
Gets the parent issue object
Gets the priority of the issue
Gets the ID of the project associated with the issue
Gets the project object associated with the issue
Gets the reporter of the issue
Gets the reporter ID of the issue
Gets the reporter user object of the issue
Gets the resolution of the issue
Gets the issue resolution date
Gets the resolution ID of the issue
@deprecated
The schema describing each field present on the issue.
Gets the security level of the issue
Gets the security level ID of the issue
The URL of the issue's details.
This property provides a direct link to the API endpoint containing the full details of the issue. It is typically used for fetching, updating, or interacting with the issue programmatically via the Jira REST API.
Example Usage:Notes:// Retrieve issue details def issue = Issues.getByKey("TEST-123") // Access the URL of the issue's API resource println "Issue Details URL: ${issue.self
" //example output: https://.atlassian.net/rest/api/2/issue/10007 }
String
Gets the issue status
Gets the issue status ID
@deprecated
Retrieves all the issues linked to the current issue.
This method queries all issues that have their "parent" field set to the key of the current issue, effectively identifying all issues associated with the parent issue. It returns an IssueIterator, which allows for efficient iteration through the results.
Example Usage in Groovy:// Retrieve the epic by its key
def epic = Issues.getByKey("EPIC-123")
// Get all stories linked to the epic
def stories = epic.getStories()
// Print the summary of each story
stories.each { story ->
println "Story Key: ${story.key
, Summary: ${story.summary}"
}
}
Notes:
Gets the collection of sub-task objects of the issue
Gets the list of sub-tasks of the issue, example usage:
Gets the summary of the issue
Gets the time spent on the issue
Gets the list of transitions available for the issue.
Gets the issue updated timestamp
Gets the number of votes for the issue
Gets the number of watches of the issue
Checks if the issue is a sub-task
true
if the issue is a sub-task, false
otherwise.Links the issue to the target issue with the specified link type, example usage:
Issues.getByKey('SR-100').link('blocks', Issues.getByKey('SR-200'))*
The link direction name you pass determines whether this is an inward or an outward link.
Here are some examples with link direction names:
linkTypeName
- the name of the link type.target
- the target issue.Links the issue to the target issue by a specified issue key with the specified link direction, example usage:
Issues.getByKey('SR-100').link('blocks', "SR-200")
The link direction name you pass determines whether this is an inward or an outward link.
Here are some examples with link direction names:
linkDirectionName
- the name of the link type.targetIssueKey
- the issue key of the target issue.Refreshes the issue to get the latest data.
Transitions the issue using the specified transition name, example usage:
Issues.getByKey(SR-100).transition('transition-name')
transitionName
- the name of the transition.Transitions the issue using the specified transition name and update specification, example usage:
Issues.getByKey('SR-100').transition('Start Progress') { assignee = 'admin' transitionOptions { skipConditions() skipValidators() } }
transitionName
- the name of the transition.specification
- the update specification.Removes the link between the current issue and the target issue with the specified link type.
This method deletes an existing issue link of the specified type between the current issue and the target issue. The link direction name determines the relationship being removed, such as "blocks", "is blocked by", or "relates to".
Example Usage:
// Unlink the current issue from a target issue with a "blocks" relationship
Issues.getByKey('SR-100').unlink('blocks', Issues.getByKey('SR-200'));
// Unlink the current issue from a target issue with a "relates to" relationship
Issues.getByKey('SR-100').unlink('relates to', Issues.getByKey('SR-300'));
Link Direction Names:
linkDirectionName
- the name of the link type to be removed (e.g., "blocks", "relates to").target
- the target issue from which the link is to be removed.Removes the link between the current issue and the target issue with the specified link type and issue key.
This method deletes an existing issue link of the specified type between the current issue and the target issue. The link direction name determines the relationship being removed, such as "blocks", "is blocked by", or "relates to".
Example Usage:
// Unlink the current issue from a target issue with a "blocks" relationship
Issues.getByKey('SR-100').unlink('blocks', 'SR-200');
// Unlink the current issue from a target issue with a "relates to" relationship
Issues.getByKey('SR-100').unlink('relates to', 'SR-300');
Link Direction Names:
linkTypeName
- the name of the link type to be removed (e.g., "blocks", "relates to").targetIssueKey
- the issue key of the target issue from which the link is to be removed.Updates the issue using the provided groovy.lang.Closure specification. This method delegates operations to an instance of IssueUpdateDelegate, which inherits additional capabilities from AbstractIssuesDelegate.
The specification
closure allows you to define how the issue should be updated
by accessing methods and properties exposed by IssueUpdateDelegate.
For a complete list of available methods and properties, refer to the documentation of
AbstractIssuesDelegate, which provides the base functionality.
Example Usage:
issue.update {
setSummary("Updated summary")
setDescription("Updated description")
setComment("This will add a new comment on the issue")
}
specification
- the closure defining how the issue should be updated.
Delegates to IssueUpdateDelegate.