Required field and condition

Andreas Hausjell March 18, 2018

What's the best way to make a field required depending on a condition to another field?

 

I want to require the field Root-Cause-Analysis, but only for Type = Incident, with priority 1, 2, 3

 

So: Not required for other ticket-types, and not for priority 4.

 

2 answers

1 accepted

1 vote
Answer accepted
Knut Arne Ristebråten
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 18, 2018

Hi,

If you are on a server, not cloud, the Scriptrunner addon allows you this feature.

You can use behaviour and a script on a field in behaviour to achieve what you want. I've used this, and it works great. Then you get the red * on the field when it is required too, instead of error message after you send the form - if you you use validator in the workflow.

Scriptrunner: https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner/server/overview
Behaviours doc: https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html

For code to set required based on another field - se answer in: https://community.atlassian.com/t5/Answers-Developer-Questions/ScriptRunner-Issues-with-required-custom-field-based-on-another/qaq-p/546310

 

Hope this helps. Note that Behaviours are not available for Cloud - you have to use a different addon, or the validator in Workflow transition. 

Andreas Hausjell March 20, 2018

I'm on a server, so I'll try this on some friday afternoon... thank you!

Moin May 23, 2019

Can you please suggest the addon or the validator for Jira Cloud.
Thanks.

Knut Arne Ristebråten
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 4, 2019

Hi @Moin 

I am sorry, but I do not have much hands-on experience with the different workflow app's for Jira Cloud.

Since the original question on this page is marked as answered, I would recommend you to create a new question in this Community asking for suggestions to solve the needs you have in Jira Cloud. I am certain that there are others in the Community that have experience in what you are after. You might get more views from people that can help if you have a unanswered question.

Sandra Fuchs November 29, 2022

What about cloud version?  Is this not possible?

0 votes
Suresh Srini October 8, 2020

I am new to Script Editor. I added the script, but doesn't look like it is working.

I added new behavior, added the field(radio button) and added Service side script. My environment is JIRA server. Any help is much appreciated. I am missing any configuration setting for the 1st time use?

Suggest an answer

Log in or Sign up to answer