I'm looking to add a workflow validator for a Bug issue type only, that makes a custom field (Severity) required. Basically something like If Bug, then Severity is required. Else severity is not required.
Hi @Fletcher Wu ,
while this might not be doable out of the box, if evaluating an additional app is applicable for you, I'd like to suggest having a look at Jira Workflow Toolbox.
Given its boolean (or "logical") validators, an expression as simple as this one will do the trick
%{00014} = "Bug" IMPLIES %{10001} != null
where 00014 is the default for issue types and 10001 would have to replaced with the matching Id of your severity field. See other examples for those validators here.
-
Update Feb 18, 2021
Since the latest major release 3.x we've introduced readable field codes resulting in the following expression for the example above:
%{issue.issueType} = "Bug" IMPLIES %{issue.cf10001} != null
Disclaimer: I'm part of the team behind the aforementioned app.
Cheers
Thorsten
Thanks I can give this a try, I requested from my IT team to try the trial out
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Fletcher Wu ,
Take a look and see if you already have an add on installed, such as ScriptRunner, Jira Workflow Toolbox (as above). Or our app, Jira Misc Workflow Extensions (JMWE). "Field required" validator will help with this issue. The library of validators, conditions, and post-functions will help you extend your workflows and support other use cases. You can try all these apps for free.
* * *
From the most recent response below, by David Fischer:
For Jira Server/Data Center:
To make the field mandatory if the issue is a Bug or Defect, you can use a Fields Required Validator (JMWE app), select the mandatory field, and use this Conditional Validation script:
issue.get("issuetype").name in ["Bug","Defect"]
If the issue is not a Bug nor a Defect than use:
!(issue.get("issuetype").name in ["Bug","Defect"])
For Jira Cloud, the same validator use case can be found here.
* * *
Good luck,
Inna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Inna
My project does have the JMWE extension for "Field required", and I did try this out however I could not figure out how to limit it to a specific Issue Type. I only want my field Severity to be required for Bug issue types, however when I try to add it via JMWE, other issue types also require it. It seems I need to add a conditional validation, however I can't figure out the Groovy expression =( Would you be able to assist me?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fletcher,
In that case, select the "Conditional Validation" option in the validator, and input the following script:
issue.issuetype.name == "Bug"
Regards,
Radhika
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you @Radhika Vijji _Innovalog_ that worked! Another quick question if I may, if I wanted to set this validator to 2 different issue types (Bug and Content Bug), how would that look? I tried adding
issue.issuetype.name == "Bug, Content Bug"
but that didn't work. Also tried them as separate individual validators, but also no luck. Any advice would be appreciated!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fletcher,
you could do:
issue.issuetype.name in ["Bug", "Content Bug"]
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.
Hi All,
i have a specific requirement. I need to have one field should be mandatory during workflow transition but not only for Issue type Bug/Defect. How to apply this?
Note: We use common workflow schemes for all projects and issue types.
Regards,
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
are you on Jira Server/DC or Cloud?
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.
you can use a Fields Required Validator (JMWE app), select the mandatory field, and use this Conditional Validation script:
issue.get("issuetype").name in ["Bug","Defect"]
although I'm not sure if you want to make the field mandatory if the issue is a Bug or Defect, or if the issue is not a Bug nor a Defect. If the latter, use:
!(issue.get("issuetype").name in ["Bug","Defect"])
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have scriptrunner? If so, you can easily to that via behaviors.
https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html
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.