I'm trying to update a custom field when the field is updated on the subtask so the parent shows the new value.
in the Script Listener console, issue.fields.parent.key doesn't work because 'parent' is not a known class in JSON.
I got that line from the Scriptrunner for JIRA Cloud examples.
It's will work on Listener like that
if
(issue.fields.issuetype.subtask ==
true
){
String parentkey= issue.fields.parent.key
}
and if you are in script console do this:
def issueKey = 'COPY-19' // enter you sub task key here
def result = get('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.asObject(Map)
if (result.status == 200){
def parentIssue = result.body.fields["parent"]
return parentIssue["key"]
} else {
return "Failed to find issue: Status: ${result.status} ${result.body}"
}
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.