I would like to know if there is a script so that I can replace the Summary field with two custom fields that the user fills in.
Scenario; user fills in the Issue Create form, and two of the custom fields (CF1 and CF2) now have data in them.
I would then like the script to run as a post function which then updates the Summary field with "CF1 relies on CF2" (for example)
Is this possible?
Hi,
You can do it with javascript or with JJUPIN.
I thought you might be able to, but I have no scripting knowledge, so I was hoping someone would be able to help me write the script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In the configuration customfield issue type scheme, put this script in the description summary field to hide it (summary field )
<script type="text/javascript"> var summuryField=AJS.$("#summary").parent(); summuryField.hide(); </script>
And in the configuration customfield issue type scheme, put this script in the description of one of your custom field
For example ids of your custom fields are like this
CF1 id = customfield_xxxxx
CF2 id = customfield_yyyyy
We put this script in the description of CF2
<script type="text/javascript"> AJS.$('#customfield_xxxxx').keypress(function(){AJS.$('#summary').val(AJS.$("#customfield_xxxxx").val() + AJS.$("customfield_yyyyy ").val());}) </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This didn't work because the Summary field is set to Required, and I can't seem to un-required it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Set summary field value with a default value.
Add this script to summary descriptinon
<script type="text/javascript"> var summuryField=AJS.$("#summary").parent(); AJS.$("#summary").val("default value"); summuryField.hide(); </script>
and you can use keyup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, so the issue is now being raised, but the value of summary is coming through as "default value"
the CF ID's are:
CF1: 11327
CF2: 11320
The description of CF2 is:
<script type="text/javascript"> AJS.$('#customfield_11327').keypress(function(){AJS.$('#summary').val(AJS.$("#customfield_11327").val() + AJS.$("customfield_11320").val());}) </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for the late reply on this!
I've tried that but the same thing is happening.
CF_11327 - Radio Button called Status with two values (Active and Disabled)
CF_11320 - Text Field (< 255 characters) called Name
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Works very Good.
<script type="text/javascript">
AJS.$('#customfield_10009').keyup(
function(){AJS.$('#summary').val(AJS.$("#customfield_10101").val()+AJS.$("#customfield_10107").val()
);})
</script>
Result is: XXXXYYYYY
How do I get the Result: XXXX_YYYYY_Name of the Reporter ?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can try something like this
<script type="text/javascript"> jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { addSummary(); }); addSummary(); function addSummary(){ $('input:radio[name=customfield_11327]').click(function() { AJS.$('#summary').val($('input[name=customfield_11327]:checked + label').text() + AJS.$('#customfield_11320').val()); }); AJS.$('#customfield_11320').keyup(function(){ AJS.$('#summary').val($('input[name=customfield_11327]:checked + label').text() + AJS.$('#customfield_11320').val()); }); } }); </script>
i suggest load javascript as webresource module in a plugin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Ashley Powell,
you write a postfunction such that get the customfield values CF1 and CF2 from issue object.
Based on your requirement of customfield values set summary using the same issue object.
Finallu update issue and re-index.
You can check for workflow module postfunction.
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.
by default, summary field is required and go through the link
Also, the postfunction will be something like this:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.security.JiraAuthenticationContext;
MutableIssue issue=(MutableIssue)transientVariables.get("issue");
Object CF1 = issue.getCustomFieldValue(cfm.getCustomFieldObjectByName("Cus1"));
Object CF2 = issue.getCustomFieldValue(cfm.getCustomFieldObjectByName("Cus2"));
//some logic
if(CF1.toString().equals("x") && CF2.toString().equals("y")){
issue.setSummary("xy"+issue.getSummary());
}
try
{
IssueManager issueManager=ComponentAccessor.getIssueManager();
JiraAuthenticationContext authContext=ComponentAccessor.getJiraAuthenticationContext();
issueManager.updateIssue(authContext.getLoggedInUser(),issue,EventDispatchOption.ISSUE_UPDATED,true);
}
catch(Exception e){
e.printStackTrace();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you can do it easily.
We do it using Kepler Rominfo's SIL custom field.
1) Get Kepler customfields from https://marketplace.atlassian.com/plugins/com.keplerrominfo.jira.plugins.keplercf
2) Create new SIL Script Custom Field for example mySILsummary
3) Enter configuration of the field
4) Click "Edit SIL Script"
5) Enter following code:
return customfield_11327 + " relies on " + customfield_11320;
6) In the post-function after issue creation just copy value from the mySILsummary to summary.
Voila.
We do it all the time with our issues, and it works like a charm :) SIL script field is really helpful every time you need a summary standarized in some way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How do you get round the fact that the Summary field is on the screen and a required field?
I'd prefer if it wasn't visible to users, and didn't need them to interact with at all.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, it is quite uncomfortable to must have the summary field on the creation screen. However, you can pre-fill it using Behaviours plugin.
In the administrative panel -> plugins -> Behaviours, add new mapping. Map to project and/or issue type you want. Than click "fields", select Summary field, and Add serverside script.
You can use similar one:
import com.atlassian.jira.issue.IssueFieldConstants
import java.util.List
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.ComponentManager
User user = ComponentManager.getInstance().getJiraAuthenticationContext().getUser()
FormField formSummary = getFieldById("summary")
FormField formType = getFieldById("issuetype")
if (formType.getValue().contains("paste here number id of issue type"))
{formSummary.setFormValue("Your summary text")
}
else
{formSummary.setFormValue("")
}
This script will prefill summary only when you choose the required issue Type.
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.