Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to make customfield mandatory based on other field value selection

Software Asset Management October 19, 2016

I have written below script which is working partially. I am able to hide the field but When I select Investment Stale, customfield is not becoming mandatory.

 


<script type="text/javascript">

jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
callChangeFunction();
});
callChangeFunction();
function callChangeFunction(){
showHidField();
$("#customfield_10019").change(function() {
showHidField();
});
}
function showHidField(){
var dropDownFieldval =
$.trim($("#customfield_10019 :selected").text());
$("#customfield_10016").closest('div.field-group').hide();
if(dropDownFieldval == 'Investment Slate'){
$("#customfield_10016").closest('div.field-group').show();

$("#customfield_10016").closest('div.field-group').setRequired(true);

}
}
});
</script>

1 answer

0 votes
saravanan subramanian
Contributor
October 20, 2016

use the validator function in the work flow - where you can set a field mandatory based on the another select list field value

 

 

 

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, team ’25 europe, early bird extension, conference discount, barcelona, hybrid event, AI teamwork, early bird pass, digital access, collaboration conference, atlassian events, register now, developer conference

1 week left to save on your Team '25 Europe pass

Still thinking about joining us for Team '25 Europe? Early bird has been extended for just one week! Now’s the time to lock in your lowest rate. Use code TEU25COMM-20 to save 20% at checkout. Hurry, this only lasts for 1 more week.

Learn more
AUG Leaders

Atlassian Community Events