Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hi Guys,
Wondering if anyone out there can help me modify this script to create a validator that will block the transition of the parent item if a Sub-task is not in a specific status.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.changehistory.ChangeHistory import com.atlassian.jira.issue.history.ChangeItemBean for(ChangeHistory changeHistory: ComponentAccessor.getChangeHistoryManager().getChangeHistories(issue)) { for(ChangeItemBean changeItemBean: changeHistory.getChangeItemBeans()) { if (changeItemBean.getField().equals("status")) { if(changeItemBean.getFromString().equals("Client Approved")) return true } } } return false
Thanks as always.
Dave
So you don't actually have to create a custom validator script to achieve this. JIRA actually does have a workflow Condition (not a Validator) called Sub-Task Blocking Condition that you can use to block the transition of the parent issue based on the status of the subtasks of that issue. It allows you to select the specific statuses that subtask has to be in, in order to then execute this parent's transition.
Does this help? Sorry if it does not, just wondering if you were trying to use a custom validator for some other reason I might not have considered.
Hi Andy,
Thanks for the suggestion. I am aware of this condition type. The reason I want to see if a validator is possible is because When a condition is not met the transition button does not appear. This lack of info can be confusing to some users. So I want the button to be visible, but if sub-tasks are not in the specified status an error message will be displayed with instructions on what they need to do.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @David Willox did you ever find and/or come up w/ a solution for how to do this?
I'm struggling to solve precisely this scenario and I've tried multiple other options including automations, post-functions, etc... All to no avail thanks to how Jira Cloud only fires the listener after all conditions/validators are run, meaning the issue gets blocked before any real-time notification can be displayed.
Best I've come up with thus far is this automation below that drops a comment on the issue after the transition is blocked which I'm now contemplating turning into an email to the user instead...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.