Copy this code in the description of a custom field (in the Field Configuration linked to the project)
<script type="text/javascript"> jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { callChangeFunction(); }); callChangeFunction(); function callChangeFunction(){ showHidField(); // dropdown custom field change function $("#customfield_10625").change(function() { showHidField(); }); showHidSubTaskField(); $("#customfield_10640").change(function() { showHidSubTaskField(); }); } function showHidField(){ //drop down field selected value var dropDownFieldval =$.trim($("#customfield_10625 :selected").text()); //test field1 $("#customfield_10639").closest('div.field-group').hide(); if(dropDownFieldval == 'Project'){ $("#customfield_10639").closest('div.field-group').show(); }if(dropDownFieldval == 'Release'){ $("#customfield_10639").closest('div.field-group').show(); } } function showHidSubTaskField(){ //drop down field selected value var dropDownFieldval =$.trim($("#customfield_10640 :selected").text()); //test field1 $("#customfield_10645").closest('div.field-group').hide(); if(dropDownFieldval == 'Project Audit'){ $("#customfield_10645").closest('div.field-group').show(); }if(dropDownFieldval == 'Release Audit'){ $("#customfield_10645").closest('div.field-group').show(); } } }); </script>
How do set values to custom fields based on system field selection? Ex. Issue Type?
LikeLiked by 1 person
You can set Javascript in the description of a field, placed on a screen (only in Jira Server)
Examples:
Regards
LikeLike
Hi,
What about if I want to show a custom field only when a customer request type is selected?
Thanks.
Nuria
LikeLike
Hi Nuria,
Yes it’s possible with a custom plugin or installing this one:
https://marketplace.atlassian.com/apps/1212161/extension-for-jira-service-desk?hosting=cloud&tab=overview
Regards
LikeLike