Snippets

Adaptavist Jira Cloud - Escalation Service - Archive Issues returned by JQL

Created by Kristian Walker last modified
/*
* This example script escalation service script shows how to archive the issues returned by the JQL for the escaltion service.
* You must specify the JQL in the JQL query box when configuring the escalation service.
* Note: you must be on a Premium or Enterpise plan to be able to use this archiving API
* "All right, title and interest in this code snippet shall remain the exclusive intellectual property of Adaptavist Group Ltd and its affiliates. Customers with a valid ScriptRunner
* license shall be granted a  non-exclusive, non-transferable, freely revocable right to use this code snippet only within their own instance of Atlassian products. This licensing notice cannot be removed or
* amended and must be included in any circumstances where the code snippet is shared by You or a third party." 
*/

// 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

logger.info("The ${issue.key} was archived succesfully.")

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.