How do I allow a transition to 'Resolved' only if all the sub-tasks are closed/resolved?

Evgeny Terekhov September 30, 2013

How do I allow a transition 'to Resolved:Fixed' only if all the sub-tasks are closed/resolved?

Is it going to be a validator or a condition? Thanks.

6 answers

1 vote
Jobin Kuruvilla [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.
September 30, 2013
0 votes
Evgeny Terekhov October 9, 2013

Ok. Thank you! Maybe there is some kind of a 'Hello World' example, or a begginer'a guide where I can read basics of how to create JIRA's groovy scripts?

0 votes
Evgeny Terekhov October 8, 2013

Bharadwaj Jannu ·

Sorry, I am just "far away" from Java programming. I was wondering if there should be any imports.. like "import com.atlassian.jira.issue.Issue".

RambanamP
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.
October 8, 2013

Yes, you have to use imports!!

0 votes
Evgeny Terekhov October 8, 2013

Thank you all for your answers!

Bharadwaj Jannu - are you sure this code is going to work? So, all I have to do is to put the code into file.groovy file, place it on my machine and setup a validator that is going to execute the /path/to/file.groovy ?

Bharadwaj Jannu
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.
October 8, 2013

My post is a Java code, you make syntactical changes according to groovy. I'm not familiar with groovy scripting.

0 votes
Bharadwaj Jannu
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.
September 30, 2013
Collection<Issue> subTaskList = subTaskManager.getSubTaskObjects(issue);

InvalidInputException e=new InvalidInputException();

Resolution resolutionObj=issue.getResolutionObject();

if(resolutionObj != null && resolutionObj.getName().equals("Fixed")){

boolean anysubtaskNotclosed = false;

for(Issue subTaskObj : subTaskList){

Status subStatus = subTaskObj.getStatusObject();

if(subStatus.getName().equals("Closed")==false && subStatus.getName().equals("Resolved")==false){

anysubtaskNotclosed = true;

break;

}

}

if(anysubtaskNotclosed){

   e.addError("resolution ", "*All subtasks must be closed before resolving the issue to fixed");

   throw e;

}

}

Bharadwaj Jannu
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.
September 30, 2013

try with the code in workflow validator and it might solve your requirement.

0 votes
RambanamP
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.
September 30, 2013

if you want to allow to resolve issue once all subtasks are closed/resolved then use the condition

check this

https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Allsub-tasksmustberesolved

if you want allow only fixed as resolution when all subtasks are closed then use validator!!

Suggest an answer

Log in or Sign up to answer