Example scripts
To homepage
Jira

Archive issues returned by a JQL Search
App in script

ScriptRunner For Jira
by Adaptavist
Compatibility

Jira
Language |
groovy
// Construct the JQL to return the issues to be archived
def jqlQuery = "updated >= '-30d' and project = 'RRR'"
// Loop over each issue
def archivedIssues = Issues.search(jqlQuery).take(500).collect { issue ->
// Archive the current issue
def archiveIssue = put("/rest/api/3/issue/archive")
.header("Content-Type", "application/json")
.body(
issueIdsOrKeys: [issue.key]
)
.asObject(Map)
// Validate the issue was archived correctly
assert archiveIssue.status >= 200 && archiveIssue.status < 300
issue.key
}
logger.info("The following issues were archived succesfully: ${archivedIssues}")
Having an issue with this script?
Report it here