Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for best way with Workflow Validator to check on children issue of Parent are done

Brian Taylor
Contributor
October 27, 2024

My Company is migrating from the Jira Data Center to the Jira Atlassian Cloud.  I have in the workflow to check if Epic and any Epic links are not in the status of Done or Closed. 

Jira Cloud has now introduced the Parent-child relationship, and I want to ensure that all children are in complete status before allowing the parent to be completed.   

I have tried a couple of different validators that are not working.  Looking for any suggestions. 

3 answers

1 accepted

1 vote
Answer accepted
Maciej Dudziak _Forgappify_
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 28, 2024

Hi @Brian Taylor 

If you are open to using apps and looking for a ready-to-use solution. We've developed the Linked Issues Validator available as part of the Workflow Building Blocks for Jira app. With a wizard-like UI, you can select options that represent your case. You can choose relations from: sub-tasks, parent issues, epic stories or children (this works both for sub-tasks and regular issues under an epic), and linked issues. Additionally, you can filter relations by issue types and select criteria based on status category and status.

I hope it would help.

Cheers

 

Brian Taylor
Contributor
October 28, 2024

Maciej - 

This partially works in that if you have issues that are not in the status of Done or Canceled, the transition does not show. You don't have any message displayed to the user. 

 

 

Brian Taylor
Contributor
October 28, 2024

Maciej, 

I miss-poke as I have set the selection up as a Condiriton and not a validator.  The validator does give the option for an overwriting message. 

This works perfectly. 

 

0 votes
Tomislav Tobijas
Community Champion
October 27, 2024

Hi @Brian Taylor ,

Sadly, I don't think you'll be able to do this natively. You might need to consider using ScriptRunner or JWME apps for this. Not sure if there's a JAC ticket for this (if anyone finds it, I would appreciate it if you'd share it).

Maybe, you could build some not-so-pretty workarounds with automation as automation rules are quite powerful and can search through linked issues, parent-child relations and such.
Just thinking out loud - maybe you can use condition Value Field which would look at a custom field named let's say "Ready for transition" that can and will be only populated by automation. E.g., automation would set this field to "Yes", the condition would then pass and users would be able to transition that particular Epic.

Cheers,
Tom

Brian Taylor
Contributor
October 28, 2024

Tomislav - 

I have tried Scriptrunner condition with the following code


issue.issueType.name == 'Epic' ?
issue.stories.every(story => ["Done", "Cancelled"].includes(story.status.name)) :
false

This partially works in that if you have issues that are not in the status of Done or Canceled, the transition does not show. You don't have any message displayed to the user. 
Tomislav Tobijas
Community Champion
October 28, 2024

Brian,

If by partially you're referring to this part

You don't have any message displayed to the user. 

That's how conditions usually work. There are no messages that will be displayed somewhere on the issue (you could use Forge or some other way to inform the end-user but that's another story).

If you would like to just 'block' transition, then you can use validator. ScriptRunner validators have field "Validation failed message" that would be displayed if the user tries to transition the issue and the validation conditions are not met (it works whether you're using screen transition or not).2024-10-28_15-15-39.png

This would mean that the transition would still always be visible even if the conditions are not met, but you won't be able to actually transition the issue until criteria is met.

0 votes
Valerie Knapp
Community Champion
October 27, 2024

Hi @Brian Taylor , thanks for your question.

Have you tried this condition?

Screenshot 2024-10-27 20.41.35.png

Please let us have your feedback about what you have already tried and what the results were.

Cheers

Tomislav Tobijas
Community Champion
October 27, 2024

Hi @Valerie Knapp this unfortunately doesn't work with Epic-Child relations. Only with standard issue type-sub-task relations. If you, for some reason, connect sub-tasks with Epics (move or change parent), then this would work as expected.

Like Valerie Knapp likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events