Hi,
I wish to update linked issues whenever the 'parent' issue is transitioned but can figure out how to do that. (it is not really parent issue but linked issue to several other).
I checked the code (without the put call) and it does retrieve the issue keys. I do get however errors when the put function is there
here is my code: (below is the second one as I thought maybe my approach is wrong and I have to use transitionID)
```
def issueKey = 'AKD-452' //issue.key
def newStatusId = '10005'
def result = get('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.asObject(Map)
// Find the linked issues
def linkedIssuesKey = result.body.fields.issuelinks.inwardIssue.key
def length = linkedIssuesKey.size()
for (i in 0..<length) {
def fields = get("/rest/agile/1.0/issue/${linkedIssuesKey[i]}")
.header('Content-Type', 'application/json')
.asObject(Map)
.body
.fields as Map
def submit = put("/rest/api/2/issue/${linkedIssuesKey[i]}")
.queryString("overrideScreenSecurity", Boolean.TRUE)
.header('Content-Type', 'application/json')
.body([
fields:[
Status: newStatusId
]
])
.asString()
return submit
if (result.status == 204)
{ return 'Success' }
else {
return "${submit.status}: ${submit.body}"
}
}
```
I thought maybe I have to use the transition id so tried this code too:
```
I also tried this code but I get error responses
def issueKey = 'AKD-452' //issue.key
def newTransitionId = '10005'
def result = get('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.asObject(Map)
// Find the linked issues
def linkedIssuesKey = result.body.fields.issuelinks.inwardIssue.key
def length = linkedIssuesKey.size()
for (i in 0..<length) {
def submit = post("/rest/api/2/issue/${linkedIssuesKey[i]}/transitions")
.header("Content-Type", "application/json")
.body([transition: [id: newTransitionId]])
.asObject(Map)
// Log out the issues transitioned or which failed to be transitioned
if (submit.status == 204) {
logger.info("Transition ${newTransitionId} performed for the ${linkedIssuesKey[i]} issue")
} else {
logger.warn("Failed to perform the transition ${newTransitionId} on the ${linkedIssuesKey[i]} issue. ${submit.status}: ${submit.body}")
}
// Collect the success status by issue key to show them as part of the script return value
[(linkedIssuesKey[0]): (submit.status == 204)]
"Status by issue key (transitioned?): ${linkedIssuesKey[i]}"
}
```