Hi,
I have a custom script that will check the value in one custom field and then based on the value, display or hide another mandatory(By Field Configuration) field.
<script type="text/javascript">
issueType = document.getElementById("issuetype-field").value;
if (issueType == "Bug") {
bug_source = document.getElementById('customfield_11737');
if (bug_source) {
customer = document.getElementById('customfield_11740');
if (bug_source.value != '11313') customer.style.display='none';
bug_source.onchange=function() {
if (this.value == '11313') {
customer.style.display = '';
customer.value="";
} else {
customer.style.display='none';
}
}
}
}
</script>
This is working fine on the create screen if the customfield_11737 is initialized with the correct value. However, if I move an issue from another issue type to bug, it mandates my second field, even if the value on the first field is wrong.
Is there any better way, I can display/hide a mandatory field based on the value in the other field?
TIA
Thanks,
Dipu H
Hi Dipu,
you're using Javascript for your customization which means it applies only to the screen and browser the end-user is using.
If you want to build a more robust customization that would work on any action taken on the issue (move, bulk edit, creation etc...) i'd look at a custom addon.
Remember that Field Configuration applies to ALL operations, meaning you can't control for which action field configurations applies. So even if you some JS magic on the frontend, you will never have a robust customization using purely JS.
I propose you look into Addons using AtlassianSDK to do your usecase.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.