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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.