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

Ryan Rosenthal June 17, 2021

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

1 accepted

1 vote
Answer accepted
Olga Videc
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 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

Ryan Rosenthal June 18, 2021

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
1 vote
Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 17, 2021

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 

Suggest an answer

Log in or Sign up to answer