We have around 8 sub-tasks (A,B,C,D,E,F,G,H) created automatically when a new Jira ticket is created.
There was a requirement came from management where on closing of first 4 sub-task (A,B,C, D) it should create another sub-task (I) and on closing of next 4 sub-task (E,F,G,H) it should create another sub-task (J).
Please let me know how we can achieve this?
Thanks in advance.
Regards
Vinay
Here is an idea for postfunction to do this:
import com.atlassian.jira.issue.Issue /** * Creates new subtasks based on statuses of other subtasks */ int closed_A = 0; int closed_b = 0; for(Issue subtask: issue.getSubTaskObjects()){ if(true)//check if subtask is one of A, B, C or D if(subtask.getStatusObject().getName().equals("Closed")) ++closed_A; if(true) ////check if subtask is one of E, F, G or H if(subtask.getStatusObject().getName().equals("Closed")) ++closed_b; } if(closed_A == 4){ //create I } if(closed_b == 4){ //create J }
Perhaps it will be interesting for you:https://answers.atlassian.com/questions/32982259
Also I would recommend you to use Script PostFunction or CreateSubtask postfunction provided ScriptRunner plugin to run this code.
Hi Vasiliy,
Thanks for the answer. You mean to say I need to add this post function on all the sub-tasks Closed status?
Can you confirm which option to select from Script Postfunction? Because I can see two similar option as per the attached screenshot.
Also can you let me know how to create Sub-tasks I and J when the count ==4?
Again thanks for your help.
Thanks
Vinay
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.
You need Create sub-task option.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi vasiliy,
Need your further help wrt to configuration.
Please let me know if the configuration as attached in the scrrenshot works. Do I need to add any more configuration.
Script Postfunction.JPG
Thanks
Vinay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi vasiliy,
Need your further help wrt to configuration.
Please let me know if the configuration as attached in the scrrenshot works. Do I need to add any more configuration.
Conf.JPG
Thanks
Vinay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Idea is follows: condition is a some boolean expression which returns "true" when you need to create a sub-task.
Here is a code for validator which checks that it requared to create a sub-task I:
import com.atlassian.jira.issue.Issue /** * Creates new subtasks based on statuses of other subtasks */ int closed_A = 0; for(Issue subtask: issue.getSubTaskObjects()){ if(true)//check if subtask is one of A, B, C or D if(subtask.getStatusObject().getName().equals("Closed")) ++closed_A; } if(closed_A == 4){ return true } else { return false }
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.