Copy Comment to Linked Issue based on workflow transition

Hello all

we are using JIRA as our internal issue tracking and also we use it as a customer support system, after several configurations we settled on this one

every client has a project in JIRA with a simple workflow, when he submit an issue, the PM receive it, and when the PM opens, JIRA automatically (through a scripted post functions) clone the issue to another JIRA project that is internal we we can work on the issue, then when everything is done and tested internal, JIRA automatically through post functions transition the parent issue to resolved in order for the client to approve or not approving it


now my question is that

how can I copy comments to linked issues based on workflow transitions

for example ( when developer transition the cloned issue to "customer feedback" the original issues will be transitioned automatically (this is easy) and the comment of the developer must appear on the original issue ( this is what i am trying to do)

also when the customer transition the issue to open (when providing feedback) the cloned issue will be transitioned to Open with the client comment embedded on it

I am trying the script runner but nothing works, it seems that I can't work with comments


please help

4 answers

1 accepted

This widget could not be displayed.

You can solve it by using "Script Listeners" section of Script runner. You can easily create a Custom listener triggered by the event "Issue Commented" and add a script similar to this one.


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.AbstractIssueEventListener
import com.atlassian.jira.event.issue.IssueEvent;

public class CopyComments extends AbstractIssueEventListener {

    void workflowEvent(IssueEvent event) {

        def linkedIssue = "PROJECT-1";
        def commentManager = ComponentAccessor.getCommentManager();
        def issueManager = ComponentAccessor.getIssueManager();

        def comment = event.getComment()
        def targetIssue = issueManager.getIssueObject(linkedIssue);

        commentManager.create(targetIssue, comment.authorApplicationUser, comment.body, true);



You might use the same logic to sync the status of the ticket.

i am going to try the status syncing and get back to you with my results

Is it possible to specify the link type? I would like to use this to copy Story comments to an Epic, and ignore any other link types being utilized.

For some reason the above code is not working for me. I am not getting any error and the Issue Commented event is working and shown as no failure but the comments are not copied to the target linked issue hard coded in the code.

Hey! how are you?

is it possible to create this listener on cloud?



AFAIK you can but the answer is so different I recommend you ask a new question and use the relevant tags, so the ScriptRunner cloud people can answer.

This widget could not be displayed.

What have you tried so far? Do you want all internal comments copied, or just the last one that the developer gave?

This widget could not be displayed.

I am trying to clone the issue an another workflow so the client can't see what is happening behind the scene when any developer ask the client to provide any info I need the last comment of the developer to appear on the client issue and when the client answer, his comment will appear on the internal workflow (linked issue)

This widget could not be displayed.

I am trying to get this to work, but my comments aren't syncing. Do you have to put the specific project name in quotes? I am trying to sync comments from one project into our JIRA Service Desk project.

I'm trying to work this one out too.


I want comments to show on both ticket.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

226 views 3 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you