Hello,
In our project, we are using a cascading select list field named Logiciel to store the application name and the application software version linked to our tickets.
The parent in the cascading select list field being the application name and the child the software version.
As we’d like to use built in gadget named “Issue Statistics” on our dashboard to see the split of the tickets between our applications (without taking care of the version), we must store the application name in a single choice select list field (I have named that field LogicielSimplifie).
To fill this single choice select List field, I have created a listener script using ScriptRunner extension. This listener is executed each time an issue is updated.
The script is called correctly and can correctly retrieve the software name from the cascading select list field.
However, I’m facing an issue within this script as I can’t figure out the syntax to update the single choice List field.
My script is the following:
// Copy Software name from Logiciel field to LogicielSimplifie field
// get custom fields
def customFields = get('/rest/api/2/field')
.asObject(List)
.body
.findAll { (it as Map).custom } as List<Map>
def input1CfId = customFields.find { it.name == 'Logiciel' }?.id
def outputCfId = customFields.find { it.name == 'LogicielSimplifie' }?.id
def fields = issue.fields as Map
def project = fields.project as Map
//if (issue == null || project.key != projectKey) {
// logger.info("Wrong Project ${project.key}")
// return
//}
def input1 = fields[input1CfId]?.value as String
def output = input1
put("/rest/api/2/issue/${issue.key}")
.queryString("overrideScreenSecurity", Boolean.TRUE)
.header('Content-Type', 'application/json')
.body([
fields: [
(outputCfId): output
]
])
.asString()
Can someone help me for the syntax to use in the “put” command to indicate that the field to update is my single choice select list field named LogicielSimplifie ? I have tried many syntaxes such as (outputCfId?.value): output or (outputCfId) ?. value: output without any success.
I tried also using JSM automation for that purpose, but I can’t access the parent part of the Cascading Select list field within automation.
Thanks for your help
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.