Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Script runner change summary from another issue

Dante Labate May 29, 2018

I need help.

 

Could someone help me write a script that changes the summary of another called.

I have in a customfield the KEY of this issue that I want to change.

 


import com.atlassian.jira.issue.IssueManager;


def issueManager = ComponentAccessor.getIssueManager()
def issue1 = issueManager.getIssueObject("${key_value}")

issue1.setSummary("XYZ")

 

1 answer

1 accepted

1 vote
Answer accepted
Roland Holban (Adaptavist)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2018

I think this is what you're looking for. It will retrieve an issue, search that issue for a custom field which holds the key of a different issue, retrieve the issue using that key, set that issue's summary to some text.

import com.atlassian.jira.component.ComponentAccessor

def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.customFieldManager

def issue = issueManager.getIssueObject("TSP-1")
def customField = customFieldManager.getCustomFieldObjectsByName("issue key")[0]

def keyOfIssueToChange = customField.getValue(issue)
def issueToChange = issueManager.getIssueObject(keyOfIssueToChange)

issueToChange.setSummary("MY NEW SUMMARY")

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events