I'm looking for a groovy script to set the reporter of an issue (sub-task) to the same user as it's parent issue.
It shall be used on a post-function via script runner.
Hello,
Your script would look like this:
if (issue.getParentObject() != null)
issue.setReporter(issue.getParentObject().getReporter())
Thank you!
You are welcome!
I have the following script in our Script Listener for JIRA Cloud.
// Auto assign reporter of parent ticket as reporter of all sub-tasksdef issueKey = issue.key
// if current issue is a sub-taskif (issue.fields.issuetype.subtask == true){
// get parent ticketdef parent = get('/rest/api/2/issue/' + issue.fields.parent.key).header('Content-Type', 'application/json').asObject(Map).body// change reporter on current ticketdef issue_reporter = put('/rest/api/2/issue/'+ issueKey).header('Content-Type', 'application/json').body([fields: [reporter: parent.fields.reporter]]).asObject(Map).body}
It looks like you're new here. Sign in or register to get started.