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

while cloing a jira ticket how to copy existing Comments and Request Participants

Srinivasan S_L_ August 5, 2020

We understand the requested feature is not available right now. 

https://jira.atlassian.com/browse/JRASERVER-5052.

While cloning a Jira ticket how to copy existing Comments and Request Participants. 

Can we use the script runner? If anyone used, please share the steps. 

Regards,

Srinivasan S L

2 answers

0 votes
Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 5, 2020

You can use script runner but you have to prepare script, you can use

def issueFactory = ComponentAccessor.getIssueFactory()
def
newIssue = issueFactory.cloneIssueWithAllFields(issue)

to clone the issue. Then you have to copy comments.

def commentManager = ComponentAccessor.getCommentManager()
def commentService = ComponentAccessor.getComponent(CommentService) // you have to import com.atlassian.jira.bc.issue.comment.CommentService

def user; // you need to initialize this with user who is creating comment, maybe some service user?

def issueComments = commentManager.getComments(issue)
issueComments.each{
def commentParametersBuilder = CommentService.CommentParameters.CommentParametersBuilder.builder(it)
commentParametersBuilder.issue(newIssue)
def commentParameters = commentParametersBuilder.build()

def validateCreateComment = commentService.validateCommentCreate(user, commentParameters)
if(validateCreateComment.isValid()){
commentService.create(user, validateCreateComment, false)
}

}

 I think request participants should be only copying of custom field, but let's try to copy comments and we will solve custom field later.

Srinivasan S_L_ August 6, 2020

Hi Martin,

Thank You for the scripts, I will try and reach you in case of any clarification. 

Thanks & Regards,

Srinivasan S L

0 votes
Reshma Begum _Appfire_
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.
August 5, 2020

Hi @Srinivasan S_L_ ,

You can clone the issue comments with Bobswift's Clone Plus for Jira. 

cloneplus.jpgThe summary, description, request participants, and other fields get copied without any explicit mention.

 

Hope it helps!

 

Thanks,

Reshma

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events