Hey,
I came up with the examples for the scriptrunner workflow validator to prevent an Epic to be closed if the tasks are not 'done'.
I used this expression but if its active I cannot close the tasks anymore. Did I do something wrong?
issue.isEpic && issue.stories.filter(story => story.status.name == 'Done').length == issue.stories.length
Hi @Thies Uhlenbruch ,
From what you have said I assume your Tasks and Epics use the same workflow?
The first part of your expression is:
issue.isEpic
So, when you are transitioning a task, this returns false, and when the expression returns false it prevents the transition.
We need to make it a little more detailed. The logic we want is:
Check to see if an issue is an epic. If it isn't, return true. If it is, check to see if all stories are done. If they are, return true, otherwise return false
So, our expression becomes:
issue.isEpic ?
issue.stories.filter(story => story.status.name == 'Done').length == issue.stories.length :
true
Could you try that and let me know how you get on?
Kind regards,
Bobby
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.