Is there any way we can force a task on JIRA not to close if the sub-task is not closed?
You are looking for a "Condition" script in the "Close" transition of the parent issue to check if all sub-tasks are closed.
Reference: https://confluence.atlassian.com/jira/configuring-sub-tasks-185729507.html#ConfiguringSub-tasks-Blockingissueworkflowsbysub-taskstatus
It's usually the other way around you don't actively stop something, you block it. In this case, you want to do nothing, not "force a task not to close". You just don't transition it it when you don't want to close it.
JIRA has conditions on workflows that are there to block actions - a very popular one is "do not allow close when the issue has one or more subtasks in status (open, in progress, held, blocked, etc)". I suspect that's the one you need.
I'm actually partial to using a validator here, not a condition; the condition hides the "close" transition, but the reason is not readily apparent. That can be documented, trained, etc, but a validator gives you the ability to verbosely explain why the operation is not permitted. Having said that, I'm currently using the built-in condition, because there is no similar built-in validator, but I plan to write the validator in the future because I get a "why can't I close issue X" question once or twice a month. Also, it's worth noting that this condition is not enough if the goal is to fully prevent the (invalid) combination of there being a Closed parent with Open sub-tasks; you also need to add conditions to "Create" and "Re-Open" to prevent adding-or-reopening subtasks against a closed parent. This can be done with the simple scripted condition: issue.parentObject == null || issue.parentObject.statusObject.name != "Closed"
Actually, on "Create Issue", that's a validator, not a condition, as you can't put conditions on "Create". I plan to change the "Re-open" condition to a validator as well, for the reasons cited above. In fact, I think I'll do that right now .
That's true, this is a case where you want the feedback for "why can't I do this". There is a balance though - if you do it with a validator, then you replace "Why can't I close..." questions with "Why did it let me go into the close screen without telling me I couldn't do it..." questions.
Thanks Gabrielle / Nic The solution suggested worked.
Here is what you need - https://confluence.atlassian.com/jirakb/preventing-issues-from-being-closed-while-the-sub-tasks-are-still-open-724928276.html
It looks like you're new here. Sign in or register to get started.