Hi! I work in JIRA cloud. How do you add conditional validations in JIRA either using the workflow or Automation.
Use Case: All Issue types have the same workflow. Issue type Bug has a custom fields F1 and Story/Task have custom field F2.
When issue type is Bug and a F1 is null, give an alert error message.
When issue Type is Story/Bug and F2 is null, give an alert error message.
I've used validators from workflows for common fields and it has worked. I know I can try to use automation somehow, but is there a way to give an alert error message?
Hi @Ritika Kapoor - unfortunately Automation does not offer any interactive elements like an alert or error message, or to force a field to be populated like a validator can.
You will need to create a custom validator from a paid third-party add-on like in these examples:
This is done with Jira Expressions.
Here's a relevant example from JWT's Use Case Library:
The actual Jira Expression from that example looks like this:
issue?.issueType?.name ==
"Story"
? issue?.customfield_20002 != null :
true
I have not had used any of these add-ons in a while, so it could be that one of them now has a "wizard" or some kind of assistant that helps you create validators without needing to learn Jira Expressions.
ALSO - man, it has been a while, so I do not know what the ? is for after issue and issueType.
Oh, I forgot that JMWE has a very useful Field required Validator that can add a conditional validation. So that's probably a great way to go if you had JMWE or purchased it:
And then another validator but for F2 and with this conditional validation:
issue.issueType.name == "Story" || issue.issueType.name == "Task"
Regarding those question marks... (Thank goodness for documentation):
In expressions where such strict rules are not desired, use the optional chaining operator
?.
. This operator behaves in the same way as regular member access, but with one crucial difference: when accessing the property fails,null
is returned.
So I think that's just a failsafe in case ... there isn't an issue or an issueType? That seems... unlikely. But ok.
Boolean logic is... weird. At least to this non-programmer. :-}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Darryl. This was very helpful. I guess I need to look for the 3rd party add-ons now.
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.