Make a field required based on another field's value

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 vote

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"?

 

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. 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

236 views 1 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you