How to copy comments (and format) from one site to another

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

How to copy comments from one site to another

Solution

  1. Create a variable called content that has the body of the json to be sent:

    1 Author ({{issue.comments.last.author.displayName}}):\n"{{comments.last.body.raw.asJsonString}}"\n

    Added " before/after the comment. The reason for this is that we need to keep the " for the content inside the code block section (when it exists). When I add the " with the comment, the final result will be "" before/after. Since this is the only scenario where we have "", we can use it with remove ("\"") (see the item below).

    (Auto-migrated image: description temporarily unavailable)
  2. On next step I created a new variable (contentfinal) that gets the value from content and remove "".

    (Auto-migrated image: description temporarily unavailable)
    1 {{content.remove("\"\"")}}
  3. On the web request, contentfinal is sent:

    1 2 3 4 { "public": true, "body": "{{contentfinal}}" }

Updated on March 14, 2025

Still need help?

The Atlassian Community is here for you.