Has anyone been able to add in a workflow validator between statuses to only fire if a checkbox is null?
Hi @Stephanie Blair
Yes, this is built in, no app needed. On a company-managed workflow, open the workflow, click the transition between the two statuses, and under Validators add a Field Required Validator pointing at your checkbox field. It blocks the transition whenever that field is empty, and for a multi-select checkbox "empty" means no option ticked, so that's your null case.
The thing that catches people out is the field has to be on the transition screen, otherwise the user can't set it and the transition just always fails. So add a screen to that transition with the checkbox on it.
If it turns out to be a team-managed project, there's no field-required validator there, so you'd lean on Restrict transition or the Remind people to update fields rule, though the reminder only nudges rather than enforces.
https://support.atlassian.com/jira/kb/require-field-edit-when-transitioning-the-status-of-a-jira-work-item/
Best, Gabriela
It's more that I need one workflow to fire when the checkbox is null and a different workflow to fire when the checkbox is checked.
Apologies, I'm still learning the verbiage here. I think what I should have said was, "Has anyone been able to add in a workflow criteria between statuses to only fire a validator if a checkbox is null?
Essentially, we only want to enforce certain fields to be populated when the SDLC process is required to be fired. So we have a checkbox noting when tickets are "SDLC Exempt" and we only want to enforce population when it's null.
Ah, that changes it. The built-in Field Required validator fires on every run of that transition, so there's no native setting to have it only kick in when the SDLC Exempt checkbox is empty. Native conditions and validators can't read the value of a custom checkbox to decide whether to run.
To get the conditional part you'd need one of the workflow apps that adds a scoped validator. JMWE, JSU and ScriptRunner all let you wrap a Field Required validator with a Jira expression, so you set it to only run when the checkbox is empty. A checkbox comes back as a list in those expressions, so empty means the list has no entries, something like customfield_xxxxx == null or its size being zero.
If you'd rather stay app-free, the other route is two transitions between the same statuses, but you'd hit the same wall since native conditions can't branch on the checkbox either, so the enforcement wouldn't be conditional. The app validator is the way to get the conditional SDLC-exempt split you're describing.
Hi @Stephanie Blair ,
I am Nacho and i am part of Decadis.
I would like to recommend our Jira Expression Validator from the Jira Workflow Toolbox app.
Using the following expression, you can specify that an issue should only be transitioned if the checkbox has no value:
issue?.customfield_NNNNN == null ? true : false
Please, replace 'NNNNN' with the ID of the checkbox custom field.
Additionally, if you want a field to be populated when the checkbox is empty, you can easily modify the expression, for example as follows:
issue?.customfield_NNNNN == null ? true : issue?.customfield_YYYYY != null
If you need assistance in this regard, please feel free to contact us via our support portal, where we will gladly assist you.
Best regards,
Nacho
Hi @Stephanie Blair,
As Gabriela said, the built-in Field Required validator runs on every pass of the transition and has no setting that skips it when SDLC Exempt is checked. The Jira expression validators suggested above are the server-side way to make it conditional.
A rule per field instead of an expression. I'm with Terano Apps, and conditional required fields like this are exactly what we built Formify for. The rule sits on each field you want to enforce:
What happens in the transition dialog:
Where it applies: the transition dialog in company-managed Jira Software spaces. Bulk transitions, Automation and REST calls don't open that dialog, so keep a server-side validator if those paths matter to you. I set this up on a test site to confirm it works as described.
Formify on the Atlassian Marketplace
Jira can make this split without an app. The rule that does it is "Restrict to when a field is a specific value", under Restrict transition in the workflow editor. It reads a checkbox field. We built the case on our own Jira site this week, in a company-managed space, with a checkbox field named SDLC exempt that has one option, Yes.
Make two transitions between the same two statuses.
Publish with "Update workflow".
What we saw: a work item with the box empty offered "Start work" and not "Start exempt work". Jira refused the move with "Field Evidence link is required." and let it through after the field had a value. A work item with the box ticked offered "Start exempt work" and not "Start work", and it moved with the field empty. "All do not equal" was true for the empty checkbox, so the null case needs no extra step.
Two limits. First, if the workflow also has a transition that goes from any status into the target status, people can use that one and go around both rules. On our site that transition stayed in the status menu next to the two new ones. The two transitions must be the only way in. Second, anyone who can edit the work item can tick SDLC exempt. Jira has no setting for who may fill one field.
It looks like you're new here. Sign in or register to get started.