Hello ,
We are Having scripted custom field with type single issue picker which contains drop down of other issues.
We need automatically move that field value to the summary. We worked around some code through listeners but it is taking the only "HR-125" but it is not reading the rest of the text. Could you please help us to achieve that at least we don't need that HR-125 our target is that only the text besides that key has to replaced.
Please find below code which you are using through listener
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.fields.CustomField;
import groovy.json.JsonSlurper
def eventIssue = event.issue
if(eventIssue.issueType.getName() == 'Onboarding-Manager Submitted'){
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField EmployeeName = customFieldManager.getCustomFieldObject("customfield_11602");
//Employee name customfield_11601 of Onboarding-HR Initiated
def summaryValue;
def cfv1 = eventIssue.getCustomFieldValue(EmployeeName);
log.warn('EmployeeName '+cfv1)
if(cfv1)
{ summaryValue = cfv1 }
def im = ComponentAccessor.getIssueManager();
log.warn('EmployeeName TETE '+summaryValue.toString())
def issueToChange = im.getIssueObject(eventIssue.id) as MutableIssue
issueToChange.setSummary(summaryValue.toString())
//def im = ComponentAccessor.getIssueManager();
//def issueToChange = im.getIssueObject(issue.id) as MutableIssue
Hi Mahesh
If you have the key, you can get any data from that specific issue. In this example the summary of the key HR-125, which will probably be the name "John", if I understand your HR-Issue type correctly.
import com.atlassian.jira.component.ComponentAccessor
def cfv1 = "HR-125"
def issueManager = ComponentAccessor.getIssueManager()
def cfvIssue = issueManager.getIssueObject(cfv1)
log.warn('issue summary of HR-125 is: ' +cfvIssue.summary)
I'm unaware of any way to do this out of the box. You would need to parse the Employee name value and then update the Summary with this value.
There are a couple of add ons that could handle this easily.
https://marketplace.atlassian.com/apps/6820/scriptrunner-for-jira?hosting=server&tab=overview
https://marketplace.atlassian.com/apps/29496/jira-workflow-toolbox?hosting=server&tab=overview
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.