Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×We'd like to be able to make a field required only when the ticket is marked as "Resolved"; it does not need to be required when the ticket is created. Is there a way to do this, either natively or through scripting?
A clever hacky-ish way to do it is to include Javascript in the description of the custom field in the field configuration. For example, here's what we use to make sure that a custom field called Resolution Notes is filled out depending on the values of a cascading select called Resolution Reason
*Field required. Please refer to <a href="http://x.y.com/display/ES/JIRA+Resolution+Reasons" target="_blank">Resolution Reason Descriptions</a> for more details. <script language="javascript"> jQuery(function() { var getFieldIdByName = function(name) { return jQuery("label:contains('" + name + "')").attr("for"); } var id = getFieldIdByName('Resolution Reason'); var first = jQuery("#" + id); var second = jQuery("#" + id + "\\:1"); if(first.length && second.length) { var dialog = first.closest("div[id$='-dialog']").keypress(function(event) { // disable Enter key if(event.which == 13) { event.preventDefault(); } }); var screen = document.URL.indexOf("CommentAssignIssue") >= 0; if(dialog.length || screen) { first.css("display", "none"); var title; var getTitle = function(s, c) { var title = jQuery.trim(s.substring(0, s.indexOf(c))); if(title == "Shortcut to Verify") { title = "Implemented"; } return title; } if(screen) { title = getTitle(document.title, "["); } else { title = getTitle(dialog.find("h2.dialog-title").text(), ":"); } first.find("option:contains('" + title + "')").each(function() { var option = jQuery(this); if(option.text() == title) { option.attr("selected", "selected"); } }); first.change(); if(title == "Not Reproducible") { second.siblings("div.description").append('<p><table border=1><tr><td><font color="#ff0000"><b>If the bug is reliably reproducible on the build in which it was found but is not exhibited on subsequent builds then the bug should be closed as Implemented with Mystery Fix as the cause of the fix. If this is the case please close this bug as Implemented.</b></font></td></tr></table></p>'); second.find("option:last").attr("selected", "selected"); } first.closest("form").find(":submit").click(function(event) { var missing = new Array(); if(second.attr("selectedIndex") == 0) { missing.push('Resolution Reason'); } var notes = jQuery("#" + getFieldIdByName("Resolution Notes")); if(notes.length && !jQuery.trim(notes.val()) && (title == "Implemented" || title == "Will Not Implement")) { missing.push('Resolution Notes'); } if(missing.length == 1) { alert('Please complete the ' + missing[0]); } else if(missing.length > 1) { alert('The following fields are required: ' + missing.join(" and ")); } if(missing.length > 0) { event.preventDefault(); } }); } } }); </script>
The usual way to do it is add a plugin that enables "make field mandatory on transition". There's plenty of them around. They're a better way to do it than javascript because it's a doddle to bypass javascript tricks, but quite complex to implement if you have cases where you only want a field mandatory in certain specific circumstances.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I agree, Nic. We usually use the two together, come to think of it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register Now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.