How to copy comments (and format) from one site to another
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
How to copy comments from one site to another
Solution
Create a variable called content that has the body of the json to be sent:
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 the only scenario where we have "", we can use it with remove("\"") (see the item below).
- On next step I created a new variable (contentfinal) that gets the value from content and remove "".
{{content.remove("\"\"")}}
- On the web request, contentfinal is sent:
{ "public": true, "body": "{{contentfinal}}" }