JavaScript to show a field depending on context and make it mandatory.


I'm looking for some JavaScript to make a field mandatory, similer to other mandarory fields in JIRA.

I have a field that needs to be mandatory, but this field's content (and data) will change depending on the context. I'm actually talking about three custom fields of different type with the same name. Depending on the context selected, depends on which custom field is displayed.

Context: X, Y, Z
X-> display db values custom field (pointing to db1)
Y-> display dropdown custom field
Z-> display db values custom field (pointing to db2)

Field displayed/name as 'Project' and needs to be mandatory, no matter what the context. So I'm looking for JavaScript to show the field depending on context (use selected) and made it mandatory.

Any suggestions or help appreciated.


2 answers

1 accepted

I decided to change my approach. I moved up one level to the issue type, creating a different issue type for each context. Each issue type has it's own entry form, field config, schemas, etc

No Javascript required ;o)

I've marked this as the answer, as it's the solution to my problem. I didn't really answer the question asked ;o)

0 vote

I'm a bit out of my depth with javascript, so I can't help you there, but I did want to point out that Jira's built-in mandatory fields don't work like that. Their content is checked on the server side after the user commits a change.

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 Apr 17, 2018 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...

768 views 2 19
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