I have a drop down with two options and I want to hide some custom required fields when one of the options is selected. The problem is that when I hide a field it stays required. So i cant complete issue creaton.
const customDateField = getFieldById("customfield_10062");
const dropDown= getFieldById("customfield_10059");
if(dropDown.getValue().value == 'option1'){
customDateField.setRequired(false);
customDateField.setVisible(false);
}else{
customDateField.setVisible(true);
customDateField.setRequired(true);
}
So the natural thing for me was to set the field required to false when I hide it but then I get the error:
Uncaught Error: UIM tried to set an invalid value for "isRequired" property on a field (fieldId: "customfield_10062", fieldType: "com.atlassian.jira.plugin.system.customfieldtypes:datepicker")
Can someone help me?