I am using the Scriptrunner listener capability of Jira cloud version to update a field called 'Urgency' based on the value of the field 'Severity'. This is for a servicedesk project.
I checked the screens (actually there is only 1 screen for create, view, edit) and the screen has both of these fields. Yet, I am not able to update the field value and it keeps giving me the above error. I am running the script as a "ScriptRunner Add-On User"
Could someone please help me to point out where the problem is and how can I address this?
Roughly, this is how my script looks:
def projectKey = "PS"
def issueKey = issue.key
def issueType = ((Map)issue.fields.issuetype).name as String
if (issueType == null || issueType != "Bug") {
logger.info("Wrong Issue Type ${issueType}")
return
}
def fields = issue.fields as Map
def severityField = get("/rest/api/2/field")
.asObject(List)
.body
.find {
(it as Map).name == 'Severity'
} as Map
def severityValue = (fields[severityField.id] as Map).value as String
def urgencyValue = "" as String
if (severityValue == "A" || severityValue == "B") {
urgencyValue = "Critical"
} else if (severityValue == "C") {
urgencyValue = "High"
} else if (severityValue == "D") {
urgencyValue = "Medium"
} else {
urgencyValue = "Low"
}
def urgencyField = get("/rest/api/2/field")
.asObject(List)
.body
.find {
(it as Map).name == 'Urgency'
} as Map
def result = put("/rest/api/2/issue/${issueKey}")
.queryString("overrideScreenSecurity", Boolean.TRUE)
.header('Content-Type', 'application/json')
.body([
fields: [
"{$urgencyField.key}": [
value: "${urgencyValue}"
]
]
])
.asString()
if (result.status == 204) {
return 'Success'
} else {
return "${result.status}: ${result.body}"
}
Hi Matthias,
I have also noticed that the macro can't seem to find blueprint templates. That's probably something we need to investigate further. However, a workaround I've found is to simply go to Space Tools -> Edit the specific template -> Save. You don't need to make real changes to the template, but editing and saving it seems to make it available to the macro. After doing this, I'm able to type in "Meeting notes" in the template box for the Create Page macro and it works.
Regards,
Josh
@Matthias Born I've backlogged this issue here: https://productsupport.adaptavist.com/browse/SRCONF-1311
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.