It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

0 votes

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 in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,073 views 11 5
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you