We're using Jira server 8.1 on-prem, with Script Runner.
I assume what I'm hoping to do will need JSU, Groovy, or some combination. I have very little Groovy experience and to be honest I don't find it's use in Jira overly readable.
The following related to an issuetype Patch, that has sub-tasks of issuetype Sub-task. The sub-task workflow is very simple and any status can transition to Rejected. The parent workflow is a little more complex, but any status can transition to Closed.
When a specific issue-type (Patch) transitioned to Closed status with a resolution of either Cancelled, Rejected, or Won't Deploy, I'd like to transition open sub-tasks to a status of Rejected with a resolution of Denied. If a sub-task has already been marked as Done, that sub-task should not be changed.
Plan B would be to add a comment to all the sub-tasks to inform the assignee that the Parent has failed with a recommendation to reject the sub-task manually. This may actually be safer given the generic use of the issue type "sub-task".
I tried using Script Runner, but I don't think I can update the children based on the parent. I started building up preconditions in the workflow with ORs to compare the parent resolution to the subset of failed Patches before updating the sub-task, then I baulked on updating the sub-task so as no to impact those already in the status of Done.
I suspect there's a better way. I'm open to suggestions, but please provide comments/context for any scripts as I'd love to use this as a learning experience too.
I suspect this post is close to what I need, but I have no idea how close it is or how to modify it to put my conditional statements in. https://community.atlassian.com/t5/Jira-questions/Sub-task-transitions-based-on-parent-issue/qaq-p/916174
Thanks in advance.