Insert excerpt |
---|
| Get Started |
---|
| Get Started |
---|
name | content-at-the-top |
---|
nopanel | true |
---|
|
Tip |
---|
Update checklists using automated scripts⚡️ |
Panel |
---|
panelIconId | 2edcc3a5-76c7-4afe-b4db-51a58d82e866 |
---|
panelIcon | :script-runner: |
---|
panelIconText | :script-runner: |
---|
bgColor | #DEEBFF |
---|
|
Info |
---|
ScriptRunner for Jirais an all-in-one admin app. Automate DevOps workflows, actions with Built-in Scripts, improve the development workflow with Hooks. Automate the behaviour of the Smart Checklist as well. |
Panel |
---|
panelIconId | 1c962329-b0c7-474c-9c15-426a686c12f8 |
---|
panelIcon | :logo: |
---|
panelIconText | :logo: |
---|
bgColor | #DEEBFF |
---|
|
Info |
---|
RequiresChecklists Custom Field→ "Checklists" Custom Field set up |
...
3.4. Choose Run Script (Run arbitrary code on transition):
...
3.5. Add a Script Code:
...
Code Block |
---|
|
//package com.adaptavist.sr.cloud.samples.events
def issueKey = issue.key
def newSummary = 'Updated by a script'
def cfName = 'Environment'
//get custom field of "seelct" type
def customFields = get('/rest/api/2/field')
.asObject(List)
.body
.findAll { (it as Map).custom } as List<Map>
def cfEnvironmentId = customFields.find { it.name == cfName }?.id
def cfEnvironment = issue.fields[cfEnvironmentId]
//get custom field
def environment = cfEnvironment['value'] as String
def propertyKey = 'com.railsware.SmartChecklist.checklist'
def propertyValue
//compare field values
if (environment == 'Production') {
propertyValue = '"- ToDo List\\n+ Checked\\nx Skipped\\n~ In Progress\\n# Another ToDo List\\n- Unchecked\\n> Quote line 1 https://rw.rw\\n> Quote line 2\\n> Quote line 3\\n"'
}else if (environment == 'Staging') {
propertyValue = '"- Uno\\n+ Dos\\nx Tres\\n~ Quatro\\n"'
}
logger.info('property' + environment)
def result = put('/rest/api/2/issue/' + issueKey + '/properties/' + propertyKey)
.header('Content-Type', 'application/json')
.body(propertyValue)
.asString()
if (result.status == 204) {
return 'Success'
} else {
return "${result.status}: ${result.body}"
} |
...
You're done! Now every time the Issue will be transitioned to
, based on the
Status |
---|
colour | Purple |
---|
title | Environment |
---|
|
field value the proper Checklist items will be added to your Smart
Checklist🎉Checklist 🎉 Insert excerpt |
---|
| Get Started |
---|
| Get Started |
---|
name | support-email |
---|
nopanel | true |
---|
|