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.
×The summary field is as far as I can tell impoosible to rename for a specific project. Given that I'm using a workflow that would result in my users being confused as to what they should do with the Summary field I would like to hide it. During creation I would then like to populate it based upon other fields.
How can I do this with JIRA 6? I've seen answers for JIRA 4 which didn't really help at all, the answer provided a javascript solution which I'm not certain where that configuration would go.
Ultimately I'm looking to rename the summary field, but because I can't I'm making an attempt to work around the issue but every idea seems to be met with road blocks.
Hi Everybody,
We have a working solution for this (at least in JIRA 6.3.12) using Javascript injection and ScriptRunner postfunction you can hide the summary field and populate it with a calculated value:
Add a scriptrunner postfunction in the "create" (after the "Creates the issue originally" step):
import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.user.ApplicationUsers import com.atlassian.jira.event.type.EventDispatchOption import com.atlassian.jira.component.ComponentAccessor CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager(); CustomField customField = customFieldManager.getCustomFieldObjectByName("First name"); String firstName = issue.getCustomFieldValue(customField)!=null?issue.getCustomFieldValue(customField).toString():""; customField = customFieldManager.getCustomFieldObjectByName("Last name"); String lastName = issue.getCustomFieldValue(customField)!=null?issue.getCustomFieldValue(customField).toString():""; customField = customFieldManager.getCustomFieldObjectByName("Office"); String office = issue.getCustomFieldValue(customField)!=null?issue.getCustomFieldValue(customField).toString():""; customField = customFieldManager.getCustomFieldObjectByName("Arrival date"); String arrivalDate = issue.getCustomFieldValue(customField)!=null?issue.getCustomFieldValue(customField).toString():""; issue.summary = "Newcomer - "+firstName+" "+lastName+" - "+office+" - "+arrivalDate.substring(0,10) def user = ApplicationUsers.toDirectoryUser(ComponentAccessor.jiraAuthenticationContext?.getUser()) issueManager = ComponentAccessor.getIssueManager() issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
2. In the Field Configuration add in description of the Summary field the following javascript code:
<div id="summaryNewCommer"> <script type="text/javascript"> (function($) { AJS.toInit(function() { var currentUrl = window.location.href; if (currentUrl.indexOf('/secure/admin/') == -1) { AJS.$("#summaryNewCommer").parent().parent().hide(); jQuery("#create-issue-submit").click(function() { var summary_value = "temp"; jQuery("input#summary").val(summary_value); }); } }) JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context, reason ) { var currentUrl = window.location.href; if (currentUrl.indexOf('/secure/admin/') == -1 && reason != 'inlineEditStarted') { var $context = AJS.$(context); jQuery("input#summary").val(''); $context.find("#summaryNewCommer").parent().parent().hide(); jQuery("#create-issue-submit").click(function() { var summary_value = "temp"; jQuery("input#summary").val(summary_value); }); } }); })(AJS.$); </script> </div>
you can use the following simple JavaScript to hide summary field and the other field value to it
<script type="text/javascript"> jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { callSummaryFunction(); }); callSummaryFunction(); function callSummaryFunction(){ var issueTypeCreate = $("#issuetype-field").val(); var issueTypeVal = $("#type-val").text(); var issuetype=$.trim(issueTypeVal); if((issuetype != null && issuetype === "Bug") || (issueTypeCreate != null && issueTypeCreate === "Bug")){ $('#summary').closest('div.field-group').hide(); var testField=document.getElementById('customfield_13786'); $(testField).change(function(){ $("#summary").val($("#customfield_13786 option:selected").text()); }); } } }); </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Francois SERGOT that worked like a treat for me on JIRA v6.4.1. Only thing I had to do to get the scriptrunner postfunction script to compile was to ensure the following statement was changed from:
issue.summary =
"Newcomer - "
+firstName+
" "
+lastName+
" - "
+office+
" - "
+arrivalDate.substring(
0
,
10
)
to
def issue.summary =
"Newcomer - "
+firstName+
" "
+lastName+
" - "
+office+
" - "
+arrivalDate.substring(
0
,
10
)
I had to insert a 'def" keyword in front of the statement and all was good after that.
In much appreciation,
Trevor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can create a customField and "Inject" JavaScript there (Not nice, but works). Simple name it "NoSummaryField" and paste your JS in the customField description. Now you can add it to your createIssue Mask.
</div> <script type="text/javascript"> jQuery("label:contains('NoSummaryField')").parent().hide(); jQuery("input#summary").parent().hide(); jQuery("#create-issue-submit").click(function(){ // TODO: fetch ur summary value here var summary_value = "TEST"; jQuery("input#summary").val(summary_value); }); </script> <div>
Worked for me on JIRA 6.0.2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In JIRA 6.3.7, JavaScript doesn't appear to work within field descriptions. It gets converted to text (html entities).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The JavaScript would go in the description of the field in a field configuration of the project. Probably the best way to do it. You can achieve similar results with the Behavior Plugin also but again requires a bit scripting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.