Example scripts
To homepage
Jira

Create Sub-tasks when a Work Item is Created
App in script

ScriptRunner For Jira
by Adaptavist
Compatibility

Jira
Language |
groovy
def eventWorkItem = Issues.getByKey(issue.key as String)
if (eventWorkItem.issueType.subtask) { // If the newly created work item is a subtask, skip the execution
return
}
def listOfSummaries = ['Subtask summary 1', 'Subtask summary 2'] // The summaries to use for
def subtaskWorkItemType = 'Sub-task' // The Sub Task Work Item Type to Use
def spaceKey = eventWorkItem.getProjectObject().key
listOfSummaries.forEach { summary ->
eventWorkItem.createSubTask(subtaskWorkItemType) {
setSummary(summary)
}
}Having an issue with this script?
Report it here