Automatic subtask change status depending on another subtask status

HI I have   six subtasks. A B C D E F

If C is rejected. I want to change tghe status of D E and F to rejected.
If D is rejected. I want to change tghe status of C E and F to rejected.
If E is rejected. I want to change tghe status of C D and F to rejected.
If F is rejected. I want to change tghe status of C D and E to rejected.

I don't have idea how to do it ussing scriptrunner.
Anyone have an example or document to do it?

Thanks in advance.

1 answer

Hi Sergio.

You could do this with a custom listener, or with a custom post function.

In this article you will find a bit of information on how to autoclose subtask. You would need to do something similar, but with a resolution like "rejected".

If you do need further help let me know.



thanks  for your help. @Daniel Yelamos [Adaptavist]

I don't want to change the resolution. I need to change the status of some subtask , not all.

I need to do how to ask if the parent have subtasks and if these subtasks are C D E issuetypes.
then of one of these C D or E are in reject status, the others subtask C D or E move to rejected status automatically.

thanks again.

Sergio, first of all, you are contradicting yourself in both of your comments.

In the first comment you state that:

"I have six subtasks. A B C D E F"

But then in your other comment you say that 

"If these subtasks are C D E issuetypes."

Aren't A B C D E and F subtasks?



Secondly, my personal recommendation is that you go through all of our documentation bit by bit and you learn how to set a post-function for scriptrunner and the different things you can do. You will find a lot of information in this community and in our documentation site. 


Finally answering your specific questions:

What you would need to use to fix your issue, is a custom post function that is set in the "close" transition. This postfunction would be triggered every time you close a function in your project, only if the issue is a subtask. I don't exactly know what you mean by your A B C D E and F subtasks, if they are types, then:

1. Within that postfunction, you need to determine if your task is a subtask or not, in order to do that you can use:


Which should return a boolean. If it isn't a subtask, don't do anything.

2. If it is a subtask, then check the issueType name, to make sure that it is within your domain [A...E]

if(issue.getIssueType().name == "A")

 For A, for example.

After that, if it is one of your types, apply the main logic of your program.  

3. To get the parent of your subtask you can use:

MutableIssue parent = issue.getParentObject() as MutableIssue

4. To get the rest of the issues within your parents, you can use:


To transition the rest of the issues to closed, you can use the link I sent you previously.


I hope this helped. Good luck with your scripts!



Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Jira

Updates to give you visibility into what's coming in Jira Server and Data Center

Hello, Community! My name is Gosia and I'm a Product Manager on Jira Server and Data Center here at Atlassian. Since 2002 when we launched our public issue tracker, jira.atlass...

755 views 1 17
Read article

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