Validator - cannot close epic until all children are done

David Plesu April 14, 2024

Hello,

 

I hope you are doing well!

I would like to create an validator in Jira Cloud - workflow for epic, that, if children are not done I cannot close the issue, this part i created with the scriptrunner validator, but it includes some issue types that are not relevant, ('Test', 'Test Execution', 'Test Plan', 'Precondition', 'Test Run'). How can I modify this validator to not include this issues, means that if I have them as a child, I will be able to close the issue!

 

issue.isEpic && issue.stories.every(story => ( story.status.name == 'Done' || story.status.name == 'Resolved' || story.status.name == 'Closed' || story.status.name == 'Mitigated' || story.status.name == 'Duplicate' || story.status.name == 'Defer' || story.status.name == 'Rejected') )

 

Thanks!

Regards,

David

2 answers

1 accepted

2 votes
Answer accepted
Floating electron
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.
April 14, 2024

Hi @David Plesu

I am from Forgappify, and we developed the Linked Issues Validator, which has a wizard that can help you build such expressions. After selecting relevant options, you will find below a Jira expression preview, which you can copy and modify further. 

community_15.04_closed_stories.png

So in your case, you need to basically add a filter clause before .every call. Also you could use statusCategory instead of statuses.

You don't want to check 'Test', 'Test Execution', 'Test Plan', 'Precondition', 'Test Run', therefore you need to add  !  before the list.

.filter( issue => !['Test', 'Test Execution', 'Test Plan', 'Precondition', 'Test Run'].includes(issue.issueType.name)))

 

Cheers

David Plesu April 15, 2024

Hi,

Thank you!

Regards,

David

Like Floating electron likes this
0 votes
Brandon Chin April 16, 2024

Hi @David Plesu ! 

Let me know if this validator works for you:

issue.isEpic && issue.stories.every(story => (
story.status.name == 'Done' ||
["Test", "Test Execution", "Test Plan", "Precondition", "Test Run"].includes(story.issueType.name) ||
["Resolved", "Closed", "Mitigated", "Duplicate", "Defer", "Rejected"].includes(story.status.name)
))

 

 

 

Suggest an answer

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

Atlassian Community Events