I'm setting up an automation using Jira Automation to copy data from one work item to another. The trigger I'm using is "Issue assigned," and I've implemented it with a lookup to the new ticket and an "Edit Work Item Fields" action set to "Copy comments from trigger work item." The problem is that I'm getting this error: "We excluded the configured field from this action as it couldn't be found: Comments." Is there a way to force the trigger's comments to appear or become accessible?
Hello @Federico Frade , you are one step from done, and the step has two versions depending on how exact you need the result. Credit where due: @Gor Greyan branch is the right iteration and @Lalithesh smart value is the right source, the remaining problem is only where the comments land, so let me close that gap.
Why your Lookup attempt failed first, because it explains both fixes: smart values like the lookup result do not reliably survive into an advanced branch's iterations. The reliable carrier is a variable created before the branch, variables persist everywhere in the rule, including inside branches.
Option 1, no web requests, and it matches what you actually asked for (author names included): post ONE comment on the destination containing every source comment, attributed and chronological, using smart-value list iteration instead of a branch:
Comments copied from {{triggerIssue.key}}:
{{#triggerIssue.comments}}
{{author.displayName}} ({{created.format("dd MMM yyyy HH:mm")}}):
{{body}}
----
{{/}}
The {{#list}}...{{/}} iteration renders every comment with its author and timestamp. One comment on the destination, full attribution, zero API calls. This is the version I would ship for a migration flow.
Option 2, if it must be one destination comment per source comment: the wall you hit with ADF disappears when you use the v2 REST endpoint, which accepts plain text bodies:
destKey, value your destination key (from your lookup or created item){{triggerIssue.comments}}, variable name comment/rest/api/2/issue/{{destKey}}/comment, JSON body:{ "body": "Comment by {{comment.author.displayName}} on {{comment.created}}:\n{{comment.body.jsonEncode}}" }
(Authenticated with an API token via Basic auth headers.) Two caveats from real use: jsonEncode is not optional, the first comment containing a quote character will break the request without it, and advanced branch iterations are not guaranteed to run in order, which is why the timestamp prefix matters, the destination reads chronologically even if creation order shuffles.
Between the two: Option 1 is simpler, needs no credentials, and satisfies the attribution requirement you stated. Option 2 buys per-comment granularity at the cost of a web request and token management. Most teams that start with 2 end up at 1 🙂
Thanks, Sami; this was the missing piece. @Lalithesh answer had already gotten me very close, but since the values ​​were being copied as concatenated body content, I hadn't thought to iterate through them (plus, I thought there was a limitation on doing this within Advanced Branches).
I applied these changes, and everything worked perfectly.
I'm attaching a screenshot of the final configuration in case anyone else comes across this thread later.
Thanks also to @Arkadiusz Wroblewski , @Gor Greyan and @Lalithesh ! for your answers there were really useful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Arkadiusz Wroblewski KB is the right direction here.
The important point is that Jira Automation can copy comments from one work item to another without using the REST API. Atlassian’s documented approach is to iterate through the source work item’s comments and add them individually to the destination work item.
In your rule, because the original work item is the one that triggered the automation, you can reference it with {{triggerIssue}} even while you are inside the branch for the destination Service Desk work item. Atlassian confirms that triggerIssue continues to point to the original triggering work item inside branches, and all normal issue properties are available on it.
So I would use an Advanced branch over:
{{triggerIssue.comments}}
Give the branch variable a name such as comment, then inside that branch add a Comment on work item action with something like:
Comment by {{comment.author.displayName}} on {{comment.created}}
{{comment.body}}
The Comment on work item action supports smart values, so there is no need to fetch the comments via REST or convert ADF manually.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok so the solution you proposed works almost perfectly, but there’s a problem: it creates the comments on the trigger work item. I want to create them on a new one instead, so I tried using a "Look up work item" action, but it didn't work. I’m not sure if this is an Automation bug or if I’m misunderstanding how to use it. In the original workflow I shared, it selected the work item correctly—but I was using it to initialize branching there, which I can't do here because I'm using a `foreach` loop (and there's a limitation preventing nested branches).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Welcome to the Atlassian Community!
The Comments actions are separate from the Edit Work Item action. To update fields such as Description and Priority, use the Edit Work Item action. To copy comments, add a separate Add Comment to Work Item action
Cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lalitesh! Thanks for the reply and the welcome. I understand the proposed solution, but it has a limitation within the "Add comment on a work item" interface (which is the only one I see for this): there is no option to copy an existing message—and therefore neither copy all of them—a feature that is available (or so I understand) from the other screen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Federico Frade You need to add a smart value to perform this action. For example, if you'd like to copy over all comments, add {{triggerIssue.comments}} smart value in the box
You can find more details about the smart values here - https://support.atlassian.com/cloud-automation/docs/smart-values-in-jira-automation/
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This works, even though it’s not exactly what I need; it combines all the comments into a single one, whereas I’d like to at least include the name of the person making each comment in the text.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Federico Frade
What is the purpose of your solution and its use case? Depending on that, there can be a couple of solutions.
Best,
Arek đź¤
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here you have some example how it could work https://support.atlassian.com/jira/kb/copy-comments-from-the-original-jira-issue-to-a-cloned-issue/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is some additional context regarding the use case:
I have a work item originating in a "common" space, and I want to automatically move it to a "Service Desk" space. That is the goal of this automation (what you are seeing is an isolated test of one part of the process).
To be more specific, the issue I haven't been able to resolve is copying comments from one work item to another—or, more precisely, copying the comment content itself (the original author isn't a priority for me).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It was asked surprisingly often on the Community Forum.
For example, here you have one example of design. https://community.atlassian.com/forums/Jira-questions/JIRA-Automation-Clone-Issue-clone-comments-link-issues/qaq-p/2603347
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.