I need help.
Could someone help me write a script that changes the summary of another issue.
I have in a customfield the KEY of this issue that I want to change.
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.component.ComponentAccessor;
def id_vaga = customFieldManager.getCustomFieldObject("customfield_16057")
def key_value = issue.getCustomFieldValue(id_vaga).toString()
def issueManager = ComponentAccessor.getIssueManager()
def issue1 = issueManager.getIssueObject("${key_value}")
issue1.setSummary("XYZ")
It depends where you add your post function. You could try also this one
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor
def id_vaga = customFieldManager.getCustomFieldObject("customfield_16057")
def key_value = issue.getCustomFieldValue(id_vaga).toString()
IssueManager im = ComponentAccessor.getIssueManager();
MutableIssue issue = im.getIssueObject(key_value);
issue.setSummary("XYZ");
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
ComponentAccessor.getIssueManager().updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false)
tks @Alexey Matveev for your response!
But I'm getting the same error as I reported in the comment above.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is a static error. If you run the script, the script would work. Or You could write like this:
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor
def id_vaga = customFieldManager.getCustomFieldObject("customfield_16057")
def key_value = issue.getCustomFieldValue(id_vaga).toString()
IssueManager im = ComponentAccessor.getIssueManager();
MutableIssue issue = im.getIssueObject(key_value) as MutableIssue;
issue.setSummary("XYZ");
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
ComponentAccessor.getIssueManager().updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I solved the problem by adding the lines below:
import com.atlassian.jira.issue.MutableIssue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
But this signaling me another mistake
Even though I save and trying to execute the transition, the summary of the other issue is not changed (and this error appears in the log)
2018-05-30 08:54:46,492 ERROR [workflow.ScriptWorkflowFunction]: ************************************************************************************* 2018-05-30 08:54:46,492 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: RH-118, actionId: 111, file: <inline script> groovy.lang.MissingPropertyException: No such property: EventDispatchOption for class: Script1725 at Script1725.run(Script1725.groovy:15)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try like this:
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
def id_vaga = customFieldManager.getCustomFieldObject("customfield_16057")
def key_value = issue.getCustomFieldValue(id_vaga).toString()
IssueManager im = ComponentAccessor.getIssueManager();
MutableIssue issue = im.getIssueObject(key_value) as MutableIssue;
issue.setSummary("XYZ");
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
ComponentAccessor.getIssueManager().updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false)
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.
Try this one
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor
def id_vaga = customFieldManager.getCustomFieldObject("customfield_16057")
def key_value = issue.getCustomFieldValue(id_vaga).toString()
IssueManager im = ComponentAccessor.getIssueManager();
MutableIssue issue = im.getIssueObject(key_value);
issue.setSummary("XYZ");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tks @Tuncay Senturk for your response!
I'm getting this error message when trying to save the script.
JIRA 7.1.7
I want to use this script in post function.
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.