Make a field required based on another field's value

Karie Kelly
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 1, 2015

I've reviewed the forums and have found solutions for this question using the Behaviors plugin and when the second field is a text field only - neither is what fulfills my need.  I cannot use the Behaviors plugin due to cost, but do have Script Runner installed.  

I need to make a multi-select list custom field, Current Products, if they select Yes from the single select custom field, Existing Client?.  

I thought ScriptRunner would be able to provide a solution, but, I've not been able to figure it out. I tried added a simple script validator. 

I had the following that when evaluated to true: 

  1. Script workflow function : Simple scripted validator : Checks script:
    cfValues['Existing Client']?.value == 'No'

It was associated with the field, Current Products and displayed the error message: 

     

You must select the products that the client has since you indicated that they were a current client. 

When I tried to use it, I just got an generic error message that there was a problem with the workflow (illegal operation), regardless of the value I selected. 

Would appreciate any solutions!

2 answers

0 votes
Karie Kelly
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 1, 2015

Thanks, @a display name.  For some reason, I was thinking the behaviors plugin was a cost or separate; I had looked at using this type of functionality over a year ago as a nice-to-have; but, now, need it to be able to assist an organization to move onto our JIRA platform. 

When i select the transition, I'm getting the generic message: It seems that you have tried to perform an illegal operation. 

 

The attached is the validator that I created. 

 

I tried setting == Yes and ==No as I wasn't quite sure if it was to display when evaluated to True or False. But, either setting yielded the same result. 

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 1, 2015

Um.  The Behaviours addon is free, like script runner, so I'm a bit confused by that statement.  Also, in later versions, Jamie has effectively merged them together, so if you're on JIRA 6.3 or above (and on the latest version of script runner for your version of JIRA), you have Behaviours as part of the Script runner.

That said, I think you're on the right track.  What error message are you getting though?  The "you must select the products..." looks right, but what is the first few lines of the "generic error message"/"illegal operation"?

 

Suggest an answer

Log in or Sign up to answer