Adaptavist ScriptRunner For Jira Cloud Create An Issue With A Label From The Script Console

Created by Kristian Walker last modified
 * This script provides an example script that shows how to create an issue from the Script Console'.
 * 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." 

// Replace Demo below with the ID of your project
def projectKey = 'Demo'
def taskType = get('/rest/api/2/issuetype').asObject(List).body.find { it['name'] == 'Task' }['id']

        .header('Content-Type', 'application/json')
                fields: [
                        summary    : 'Task Summary',
                        description: "Task Description.",
                        // Replace customfield_10100 with the ID of your custom labels field below
                        customfield_10100: ["ALabel"], // Note the labels field is an array so new labels can be added as a comma seperated list
                        project    : [
                                key: projectKey
                        issuetype  : [
                                id: taskType

Comments (0)


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