How to assign the subtask to the reporter after it is closed?

1 minute read

Usecase: The jira admin creates a subtask in the parent issue and assigns it to the ‘developer 1’. The subtask needs to be automatically assigned back to the reporter once the subtask is closed. You can use the post function to achieve it using the ScriptRunner and the below Groovy script.

Groovy script:

// Get the type name of the current issue.
def taskType = issue.getIssueType().getName();
// Get the status of the current issue
def taskStatus = issue.status.name;

// Check the current issue type is subtask and the status is done.
if(taskType == "Sub-task" && taskStatus == "Done"){
    // Set the reporter of the subtask to the current assignee.
    issue.setReporter(issue.assignee);
}

Leave a comment