Validate Child Issues are Closed before Parent Issue Can Be

Simon Logan July 19, 2018

Hi,

There seems to be build in workflow condition for this for 'sub-tasks' but our hierarchy is:

  • Initiative
  • High level Epic
  • Feature ( which replaces Epics ) 
  • Story
  • Sub Task

Ideally I'd like a solution for checking each child issue type(s) to be 'closed' / 'done', before the parent issue can be closed.

Any examples would be gratefully received, including using ScriptRunner.

Thanks,

Simon

1 answer

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 19, 2018

Hi,

one way to achieve this is to use the "Linked Issues Status" Condition of the JMWE for Jira Server app. Only the Initiative to Epic constraint won't work, because Jira Portfolio doesn't use issue links for that. For that, you'll need a Scripted (Groovy) Validator with a short Groovy script:

!!jqlSearch( "\"Parent Link\" = ${issue.key} and status not in (Closed,Done)", 1 )

where you'll replace Close and Done with the statuses the child issues (e.g. High-level Epics of the Initiative) must be in.

Simon Logan July 23, 2018

Thanks for the reply David.

I was thinking there would probably be a solution with a plugin, but I was hoping there would be something 'out of the box'.

Regards,

Simon

Andy Ukasick October 2, 2018

@David Fischer

Hi David.  I have a similar problem.  In my case, we have "Feature" as the Parent (Parent Link) of an Epic. I want to prevent the Feature from moving to the In Progress status unless at least one of it's children is in the 'In Progress' status. How would the groovy script be crafted for that?

I also need to prevent the Feature from being able to transition to Complete unless all of its children are in either a Done or Deleted status.  I applied your script above in a "Scripted (Groovy) Condition (JMWE add-on) Condition" on the transition to Complete for the Feature. When I tested it, it didn't work. The transition was allowed when it should not have been. I'm sure the answer is obvious to someone who knows anything about groovy scripting, but that's not me. Since I'm using a condition vs a validator should I have used "in" vs "not in"?  I'd greatly appreciate your help.  Thanks!

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 3, 2018

To prevent the Feature from moving to the In Progress status unless at least one of its children is in the 'In Progress' status, this script should work:

!!jqlSearch( "\"Parent Link\" = ${issue.key} and status in (\"In Progress\")", 1 )

To prevent the Feature from being able to transition to Complete unless all of its children are in either a Done or Deleted status:

!jqlSearch( "\"Parent Link\" = ${issue.key} and status not in (Deleted,Done)", 1 )

which checks that no child issue is in any status other than Done or Deleted.

Andrew Ukasick October 22, 2018

Hi David.  Sorry to be taking so long to respond but I was on vacation. I just wanted to thank you for you help. The code you provided worked perfectly!  I don't know how anyone could get by without the JMWE Add-on.

 

Thanks!

Simon Logan October 23, 2018

Hi @David Fischer ,

Thanks for the response, sounds like your plugin does what we need, albeit with a little bit of scripting.

Can you confirm what licence tier we'd have to purchase at please? We currently have 2,000 JIRA server licence, although only about 500 are used, would we have to match that? I'm not sure there would be sufficient benefit for the functionality to warrant $2K per annum.

Regards

Simon

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 23, 2018

Hi Simon,

licensing for JMWE works the same way as for any Jira app sold on the Atlassian Marketplace: the license tier must match that of Jira itself. 

I understand that purchasing JMWE for a single feature might be overkill. However, I believe JMWE actually has much more to offer so you might want to read a little about its other features.

Regards,

David

Jeanne Howe November 19, 2018

David,

Is there a way to do this with JMWE in JIRA Cloud?

 

Jeanne

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 19, 2018

Unfortunately not, because Jira Cloud doesn't support custom Validators added by apps (except for completely static ones).

Deleted user July 30, 2019

Hi all, I've managed to implement the following use cases in JMWE for Cloud:

1) Trigger "Transition on Linked Issues" to automatically put the Parent "In Progress" when the first child goes to "In Progress".
2) Trigger "Transition on Linked Issues" to check if all the children are "Done" so that we can move the Parent to Done too automatically.

By applying these rules to the entire hierarchy we are using Initiative->Feature->Epic->Story->Subtask, we are somehow assuring that the Parent only goes to In Progress when the first child goes to and gets Closed only when all the children get Closed too. (this scenario you can actually achieve through a validator too).

Please reach out if you need further help on this type of issues.

Like andriano zg likes this
Radhika Vijji _Innovalog_
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.
July 31, 2019

Hi,

JMWE Cloud now offers conditions and validators. So you might want to try them to simplify your workflow.

Regards,

Radhika

Deleted user August 1, 2019

Thanks @Radhika Vijji _Innovalog_ for your feedback.

So, can you give a concrete example of how would that look like if I want to validate:
1) That at least one child issue is in progress while trying to move the parent.
2) That all children are closed before being able to close the parent.

I kindly ask you to be specific about the options / scripts used for the purpose.

Thanks,

Annamalai, Krishnapriya May 20, 2022

@[deleted] @Radhika Vijji _Innovalog_   Do we have any option to restrict the closure of Capability  using the JMWE validator / any script validator 

We are looking to close the Capability only when all epics are closed . We use JIRA cloud

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 22, 2022

Hi @Annamalai, Krishnapriya ,

I assume Capability is an issue type above Epics in your Advanced Roadmap hierarchy? If so, there's unfortunately no way at this time to access the hierarchy from Jira Expressions, which is the only way to write Validators in Jira Cloud. This is a Jira Cloud limitation: https://ecosystem.atlassian.net/browse/ACJIRA-1766

Like Annamalai, Krishnapriya likes this
Antonio D'Errico March 10, 2023

Hi @David Fischer 

 

i get this error when i try to use the groovy code above:

 

{ 2 "timestamp": "2023-03-10T10:36:12.827Z", 3 "webhookEvent": "jira_expression_evaluation_failed", 4 "expression": "!!jqlSearch( \"\\\"Parent Link\\\" = PDM-1784 and status not in (Done)\", 1 )", 5 "errorMessages": [ 6 "Evaluation failed: \"jqlSearch\" - identifier not available in context" 7 ],

 

Validator:

!jqlSearch( "\"Parent Link\" = ${issue.key} and status not in (Done)", 1 )
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2023

The code shared above is for Jira server/DC. On Jira Cloud you're limited to Atlassian's Jira Expressions language which does not support running JQL searches. See https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Re-Re-Validate-Child-Issues-are-Closed-before-Parent-Is/qaq-p/2035265/comment-id/94382#M94382

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events