Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

[Automation] Copy Task's latest comment to its Parent

Amy Chang
Contributor
May 15, 2024

Hi Community,

I want to copy Task's latest comment to its Parent, and the scenarios contain:

1) the comment is added to the Task ticket and copy it to the Epic

2) the comment is edited, update its content to the Epic

3) the comment is removed, remove the same comment in the Epic

 

For the first scenario, I can successfully copy the comment to the Epic. However, if the comment includes an attachment, the attachment will show "Preview unavailable." (see attachment below)

For the 2nd and 3rd scenarios, I'm not sure whether they are possible to make it.

Screenshot 2024-05-16 at 2.58.25 PM.pngScreenshot 2024-05-16 at 2.58.36 PM.png

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2024

Hi @Amy Chang 

With built-in automation features, I believe rules can only detect and  copy the add and the delete of a comment, but not the edit case.

For add, you may just add the comment as given by the trigger.  For delete, you may use the smart value {{comment.body}} from the trigger to search in the parent's comments to find the comment id, and then delete the comment.

For edit, it appears the changelog is not available for the Comment Edited trigger.  And so the prior comment body text cannot be used to search the parent issue's comment and find the one to update.

There may be marketplace apps to help with synching fields like this; please check with your Jira Site Admin to learn what is available.

 

To do this without additional marketplace apps...

A complicated and brittle workaround for the edit-case might be to include the parent issue's comment id with each child issue's comment, helping to find it later.  This approach could be broken if a person removed the data by editing a child issue's comments.  If you want to try it, an example rule for copying comments added could be something like this:

  • trigger: issue commented (i.e., comment added)
  • condition: issue type is not Epic
  • condition: trigger issue has a parent
  • branch: to parent
    • action: add comment on issue, to copy from the trigger issue
  • action: re-fetch issue
  • action: lookup issues with JQL, to get the parent issue's data with
key = {{triggerIssue.parent.key}}
  • action: edit comment, selecting the option of Last Comment, and updating the body text with:
{{comment.body}}

Parent Comment id: {{lookupIssues.first.comments.last.id}}

Now the edit and delete rules may be easier, as the parent comment's id may be extracted directly from the child comment using text functions.

Please note well: I have not tried this workaround, so experiment if you want to use it.

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events