Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is it possible to have a required field based on a condition?

We have a complex employee change system setup and I would like to set required checklists based on what is selected in another field. So if option A is selected in field 1, require field 2 be filled out. If option B is selected in field 1, require field 3 be filled out.

I have used validators to set required fields in the past. Would something like the above be possible using validators and/or automation rules.

 

For additional information, we have both Jira Automation Suite (JSU) and Automation for Jira installed. 

2 answers

Hi Ryan,

Yes it's possible.  However, I would recommend using JMWE, Power Scripts or Scriptrunner which provide you with the option to have scripts.  We have all of them (including JSU) and I don't see the option on JSU.

What you need to do is to have a scripted validator (SIL or groovy) and return false or true values. 

if (option==b){
if (field_1== null || field_3==null){
return false; // one of them was left empty so an error message will display
}
else {
return true; // the field 1 and 3 has data so it passes the condition.
}
}

 

I hope you get the idea. 

Cprime: https://confluence.cprime.io/display/JJUPIN/Cloud+Conditions+and+Validators

JMWE: https://innovalog.atlassian.net/wiki/spaces/JMWE/pages/73302028/Scripted+%28Groovy%29+Validator 

0 votes
Olga Videc Community Leader Jun 18, 2021

Hello @Ryan Rosenthal 

You can add conditions to transition and combine them with validators.

But you would need to create 2 transitions from the same statuses because conditions will not show the transition if the conditions aren't fulfilled. You can have multiple transitions with same name.

Example from Open -> In Progress

First transition 

   Add a condition to transition - Value filed (JSU) option A is selected in field 1 

   Add desired validators

Second transition

   Add a condition to transition - Value filed (JSU) option B is selected in field 2

   Add desired validators

 

BR, Olga

Thank you Olga,

 

I saw that in the JSU options and was thinking that might work. I'll give that a try. 

Like Olga Videc likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you