Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,552,687
Community Members
 
Community Events
184
Community Groups

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

1 vote
Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 16, 2017

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.

Cheers!

Dyelamos

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.

Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 16, 2017

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:

issue.getIssueType().isSubtask()

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:

parent.getSubTaskObjects()

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!

Cheers!

Dyelamos

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events