I am just trying a take the value from a custom field and add it to the current summary. I am using the code below in script runner and in the result I get the new summary that I want, but the issue summary does not actually update. Please help
ComponentManager componentManager = ComponentManager.getInstance()
IssueManager issueManager = componentManager.getIssueManager()
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()
def issue = componentManager.getIssueManager().getIssueObject("PR047EXE-74")
// gets the value from a custom field which is 123
def QCNum = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'QC Defect ID'};
def QCNumValue = issue.getCustomFieldValue(QCNum);
//add the 123 and a : before the current summary
def newSummary = QCNumValue + ": " + issue.summary;
issue.summary = newSummary;
//in script runner the result is "123: summary" which is exactly what I want the summary to update to but it never updates... it just stays "summary" --- please help
Maybe this will work for you
import com.atlassian.jira.issue.Issue; import com.atlassian.jira.issue.IssueManager; import com.atlassian.jira.issue.MutableIssue; import com.atlassian.jira.component.ComponentAccessor; void setSummary(String key,String newSummary) { IssueManager im = ComponentAccessor.getIssueManager(); MutableIssue issue = im.getIssueObject(key); issue.setSummary(newSummary); issue.store(); } setSummary("CD-4","Insert your Summary");
Doesn't work
issue.store();
is deprecated.
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.