How to Sync a Comment with a Remote Issue Key in Jira Cloud?

    In some cases, you want to know where the comment came from, specifically, when you have several Projects in sync. 

    With Exalate, you can show the remote Issue Key when synching comments. 

    You can configure the Data filter to send the comment with the issue key to the destination side.  Or configure Create/Change processor to display remote issue key with the incoming sync comment request.

    Source Side

    Use the code below to send the issue key.

    Outgoing sync

     replica.key = issue.key

    Destination Side 

    Use it when you want to display the remote issue key with a comment on your side for incoming sync requests.
    Incoming sync

    Display the remote issue key in the comment:

     issue.comments  = commentHelper.mergeComments(
               issue, replica, { 
                   comment ->
                     comment.body = replica.key+", "+comment.body

    Display the remote issue key as a simple link in the comment. 

    The code below shows how you can construct the link itself using Groovy scripting.

    issue.comments  = commentHelper.mergeComments(
        issue, replica,{
            comment ->
                comment.body =  "[" + replica.key
                    + "|https://INSTANCE_URL/browse/"+replica.key+"]"
                    + ", "+comment.body