Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Change subtask summary

Andrew Striletskyi June 25, 2018

Hello everyone. I have a part of my script:

 



def newArtifactCreate = issueManager.createIssueObject(issue.reporter,newArtifactIssue)
def subtasks = artifactIssue.getSubTaskObjects()
if (subtasks) {
subtasks.each { subtask ->
def toclone = issueFactory.cloneIssue(subtask)
def cloned = issueManager.createIssueObject(issue.reporter,toclone)
cloned.summary = "["+projectRelease+"]"+cloned.getSummary().replace("[Project name]"," ")
subtaskManager.createSubTaskIssueLink(newArtifactIssue,cloned,issue.reporter)
def labels = labelManager.getLabels(cloned.id).collect{it.getLabel()}
labels -= 'Template'
labelManager.setLabels(user,cloned.id,labels.toSet(),false,false)
// cloned.setSummary("["+projectRelease+"]"+cloned.getSummary().replace("[Project name]"," "))

}
}  

 I want to change summary for this scripts. But I can't do It. Summary is not changing and I don't know why (even using setSummary() method

2 answers

1 accepted

0 votes
Answer accepted
Mark Markov
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.
June 25, 2018

Hello @Andrew Striletskyi

add this after setSummary()

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
ComponentAccessor.getIssueManager().updateIssue(user, cloned, EventDispatchOption.ISSUE_UPDATED, false)

 imports

import com.atlassian.jira.event.type.EventDispatchOption
Andrew Striletskyi June 25, 2018

Oh , thank you

0 votes
Alexey Matveev
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.
June 25, 2018

Hello,

Your script should look like this:

import com.atlassian.jira.event.type.EventDispatchOption


def newArtifactCreate = issueManager.createIssueObject(issue.reporter,newArtifactIssue)

def subtasks = artifactIssue.getSubTaskObjects()
if (subtasks) {
subtasks.each { subtask ->
def toclone = issueFactory.cloneIssue(subtask)
def cloned = issueManager.createIssueObject(issue.reporter,toclone)
subtaskManager.createSubTaskIssueLink(newArtifactIssue,cloned,issue.reporter)
def labels = labelManager.getLabels(cloned.id).collect{it.getLabel()}
labels -= 'Template'
labelManager.setLabels(user,cloned.id,labels.toSet(),false,false)
cloned.setSummary("["+projectRelease+"]"+cloned.getSummary().replace("[Project name]"," "))
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
ComponentAccessor.getIssueManager().updateIssue(user, cloned, EventDispatchOption.ISSUE_UPDATED, false)
}
}  

Suggest an answer

Log in or Sign up to answer