Forums

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

Change subtask summary

Andrew Striletskyi
Contributor
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
Contributor
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
TAGS
atlassian, mindful member, mindful member badge, atlassian community, community kudos, community giveaway, atlassian swag, community values, empathy and kindness, badge challenge, atlassian learning, community engagement, swag giveaway

Earn a Badge, Win a Prize 🎁

Earning the Mindful Member badge proves you know how to lead with kindness, plus it enters you into a giveaway for exclusive Atlassian swag. Take the quiz, grab the badge, and comment on our announcement article to spread the good vibes!

Start here
AUG Leaders

Atlassian Community Events