Transition Parent Issue when a some customfield in all sub-task was updated

Hi Friends!

There is a way to transition parent when all sub-tasks change the status.

But is it a way to transition parent issue when simple checkbox field with one value are marked in all sub-tasks?
In other words I need to transition parent issue when the checkbox customfield in the last sub-task was updated.

2 answers

This widget could not be displayed.

Hi friend,

Actually the fast track is not an option for you because this will fast track the issue where the update happen, so in your case the subtask.

You want a custom listener where will listens for Issue Updated events and if the updated issue is a subtask then it should go to the parent, get all it's subtasks and if all of them have selected at least the value you want then it will transit the parent. 

Therefore you custom listener, that listens for an Issue Updated event and for the project/s you want. Now, your script (and for a JIRA v7) will be

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.workflow.TransitionOptions

def change = event?.getChangeLog()?.getRelated("ChildChangeItem").find {it.field == "CheckBox A"}
if (! change) {
    // there was an update issue update but it was not the checkbox therefore do nothing

Issue issue = issue

def flag = true
def ACTION_ID = 21 // replace with the action id that you want to transit the parent

// is not a subtask therefore do nothing
if (! issue.isSubTask())

def cwdUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

// iterate over the subtasks if at least on of the subtasks has notn the value 'Yes' checked then return false
issue.getParentObject().subTaskObjects?.each {subtask ->
    def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("CheckBox A")
    def cfValue = subtask.getCustomFieldValue(cf)
    if (! ("Yes" in cfValue*.value) || !cfValue) {
        log.debug ("Yes option is not selected for subtask ${subtask.key} or there is no option at all")
        flag = false

// it it reaches here means all the subtasks have selected ONLY the value yes for the custom field CheckBox A
if (flag)
    transitIssue(issue.parentObject, ACTION_ID, cwdUser)

// this means that all the subtasks have the value 'Yes' checked, therefore return true and make the transition
def transitIssue(Issue issue, int actionId, ApplicationUser cwdUser) {
    def issueService = ComponentAccessor.getIssueService()

    IssueInputParameters issueInputParameters = issueService.newIssueInputParameters()

    def transitionOptions= new TransitionOptions.Builder()

    def transitionValidationResult =
        issueService.validateTransition(cwdUser,, actionId, issueInputParameters, transitionOptions)

    if (transitionValidationResult.isValid()) {
        return issueService.transition(cwdUser, transitionValidationResult).getIssue()

    log.error "Transition of issue ${issue.key} failed. " + transitionValidationResult.errorCollection

For you information the checkboxes can have more than one value. So in the script above will check if at least on of the selected values (for each subtask) is Yes then it will transit the parent.

Hope that helps.

Regards, Thanos

Hi Thanos!

Many thanks for your incredible script smile Tomorrow I will check it and come back with the answer.

Hi Thanos!
I still was not able to completely check your great script. Moreover I found a workaround by using of Automation wich allows to transit an issue automaticly by checking a checkbox and then I use post-function from my description.

But I have marked your reply as an answer because I think it will work and someone can use it in the future!

See you

This widget could not be displayed.

You would need to write a customer listener using script runner for doing that.

Check here for some examples:


Hi Ravi. Thanks for the answer!

So I think I should use Fast-track transition an issue listener.

In this case what do I need to choose as event when sub-task is updated?

Which condition helps me to check that all e.g. customfields_10800 have checkboxes?

Sorry I am not good at script writing smile

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

148 views 1 4
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you