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