Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automation to replicate comments

Mayki Gonçalves December 28, 2022

Good afternoon, I have a question if it is possible through automation for Jira to create an automation where the same replica the comment made in the parent incident. This replication would be done as a matter of links, called daughtersautomação_replica.png
automation happens when the status changes from in progress to waiting for analysis, with that it does some checks and creates a variable pulling the value {{issue.comments.last.body}} and there is a branch for the linked issue where there is an action to comment on this issue.


{{#issue.comments}}
Comment by : {{author.displayName}}
{{ultimoComentario}}
{{/}}


however , when creating the comment to the linked issue, it is not attaching the value of the created variable {{ultimoComentario}}

1 answer

1 accepted

2 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 28, 2022

Hello @Mayki Gonçalves 

Please show us the Audit Log for the execution of the rule where the comment is not created correctly.

Please show us the details for the step where you are creating the variable.

Consider adding Log actions to print in the Audit Log the value of the variable and the smart value you are trying to assign to the variable.

Mayki Gonçalves December 28, 2022

Hello @Trudy Claspill

When starting the automation, it ends successfully but it does not bring the result I expected, I believe I am doing it wrong. I can say that I am a beginner as a project admin.

log_automation.png

 But I also don't know if i'm following the correct path to create a varuabke abd attach a value to it.
var.png

I believed that because it was in a single automation it single automation it was not possible to create the variable, attach a value and then comment.

With that I divided the automation but the effect was the same, without success

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 28, 2022

In the Add Comment action is this what you have entered?

{{#issue.comments}}
Comment by : {{author.displayName}}
{{ultimoComentario}}
{{/}}

If so, you don't need the first or last lines.

Also, what are you trying to do with this line?

Comment by : {{author.displayName}}

Are you trying to include the name of the original Comment author in the body of the new comment?

You are using the correct method to create a variable, but you actually don't need to create a variable at all. You can reference the trigger issue's last comment directly this way:

Comment by : {{triggerIssue.comments.last.author.displayName}}
{{triggerIssue.comments.last.body}}

Using the "issue" object will reference the issue currently in context. Within a branch that would be the issue you want to act on in that branch. If you are in a branch and you want to reference something from the issue that triggered the rule you can use the "triggerIssue" object.

Also, using this syntax indicates that you want to iterate over all items in the "issue.comments" list.

{{#issue.comments}}
...
{{/}}

You would use something like that if you wanted to add all the comments into one new comment body:

{{#triggerIssue.comments}}
Comment by : {{author.displayName}}
{{body}}
---
{{/}}
Mayki Gonçalves December 28, 2022

I want to show wo commented because the linked issues will show the "Automation For Jira" comment, so with displayName we will know who commented on the parent issue.

 

Thank you very much for the instructions, i changed it a little and arrived at the desired one.

Comment by : {{triggerIssue.comments.last.author.displayName}}
{{triggerIssue.comments.last.body}}

 Now I comment on issue JIR-41 and the comment is replicated on linked Issue JIR-42

JIR41.pngJIR42.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events