You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I've been looking everywhere for a script that copies comments both ways, that is, from parent to bubtask and from subtask to parent, and I finally have it :)
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.issue.watchers.WatcherManager
import com.atlassian.jira.user.ApplicationUser
MutableIssue issue = event?.getIssue()
CommentManager cm = ComponentAccessor.getCommentManager();
WatcherManager wm = ComponentAccessor.getWatcherManager()
ApplicationUser currentUser = event.getUser()
ApplicationUser epmjraplugin = ComponentAccessor.getUserManager().getUserByName("epmjraplugin")
if (issue.issueType.name.toUpperCase() == "STORY" || issue.issueType.name.toUpperCase() == "BUG" || issue.isSubTask()) {
if (!currentUser.equals(epmjraplugin)) {
def comment = event.getComment()
if (issue.isSubTask()) {
issue.getParentObject().each { it ->
Issue sourceIssue = it
log.error(sourceIssue)
log.error(sourceIssue.getIssueTypeId())
log.error("status źródła " + sourceIssue.getStatusId())
cm.create(sourceIssue, epmjraplugin, "Comment copied from sub-task's comment: $event.issue.key" + "\nComment added by: " + event.getUser().getDisplayName() + " \nComment content: " + comment.getBody(), true)
}
} else {
issue.getSubTaskObjects().each {
Issue sourceIssue = it
log.error(sourceIssue)
log.error(sourceIssue.getIssueTypeId())
log.error("status źródła " + sourceIssue.getStatusId())
cm.create(sourceIssue, epmjraplugin, "comment copied from main task's comment: $event.issue.key" + "\nComment added by: " + event.getUser().getDisplayName() + " \nTreść komentarza: " + comment.getBody(), true)
}
}
}
}
//"Comment from sub-task: $event.issue.key:\n{quote} $event.comment.body {quote}",