Hey guys,
I'm trying to populate the summary field in one issue type (not all), so that it does the following:
When users select "create issue" > "new starter form", the summary field will be pre-populated with "New Starter - Name - Due Date" (these aren't variables, or calculated entries, just standard text).
I've seen in http://jira.10933.n7.nabble.com/Can-I-populate-a-field-based-on-selection-of-another-during-Create-Issue-td25541.html that you can use a custom field to populate the summary field, but I can't seem to get this to work.
Any help would be great!
Thanks
Alex
try with the following code, if you want to copy value from the other fields to summary field
<script type="text/javascript"> jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { addSummary(); }); addSummary(); function addSummary(){ var issueTypeCreate = $("#issuetype-field").val(); var issueType = $("#issue-create-issue-type").text(); if((issueTypeCreate != null && issueTypeCreate === "Bug") || issueType === "Bug"){ //if you want hide summry field use this //$('#summary').closest('div.field-group').hide(); $("#SVNKitNPIProjectSelect").change(function(){ // use this if you want to copy value from select list field to summary field var selectList=$("#customfield_10407 option:selected").text(); $("#summary").val(summaryValue); //or use this if you want to copy text field value to summary var textFieldVal=$("#customfield_13815").val(); $("#summary").val(textFieldVal); }); } } }); </script>
is this what your looking for you?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Heya,
Thank you for the assistance.
In regards to this, would I put this script in the summary field default value or in a custom message field (edit)?
Many thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
add the above script in custom field description in field configuration that issue type or you can add it to plugin as webresource module
check this post to know how to add it to plugin as web-resource module
https://answers.atlassian.com/questions/47843/strange-javascript-problem-in-create-screen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am trying to do the same thing, set the Summary from a custom field that is a select list.
I would like the summary to be what the selected text is.
I've looked at the above example and do not understand what I should change #SVNKitNPIProjectSelect to? I tried changing it to the name of the custom field and #customfield_10008 , but I cannot get it to work. The JavaScrpt runs up to the hiding of the summany.
Any insights would be appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I'm new at all this scripting and am trying to format the Summary field.
I have 2 fields which the user fills out and I want to use those values to pre-populate the Summary field. How do I have to modify the above code in order to get it to work? I have the following 2 fields:
1) JProject
2) ATID
I want the Summary field to be formatted with the words "Access Request" followed by the value in JProject followed by the value in ATID. Could someone please help while I try to learn javascript?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Faisal,
You'd probably better off in the long term keeping the 3 pieces of information separate in the issue type field, JProject and ATID fields. Then display them next to each other in the columns of the issue navigator.
If you paste them altogether into one field someone is only going to ask you to parse that field later on, which will be tedious. Store the info in one place only
If you really have to have a read-only calculated field to show this then use the Script Runner add-on (not available inOnDemand)
~Matt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Matt,
I did not know you could configure the Issue Navigator (I'm new at all of this). I'll look into it as it may be a good workaround for me.
Thank you for the suggestion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Seems that didn't work unfortunately.
I did however, find another method of doing it:
<script
type
=
"text/javascript"
>
if
(AJS.$(
"#summary"
).val().length <= 0){
AJS.$(
"#summary"
).val(
"New Starter - Starter Name - Start Date"
);
}
<
/script
>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does this still work for you (what version of JIRA are you currently utilizing)? I thought they were moving away from allowing scripting in the description of the field.
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.