Jira Automation to Delete Specific Comments when Issue is Transitioned

Suraj Gurav April 17, 2024

Hello People,

I'm trying to setup an automation in Jira, to delete comments from a specific user when the issue is transitioned from 'In Progress' to 'Done'.

So far I managed to get list of all such comment IDs in a Json Array. However, I'm unable run automation iteratively over all this Json array to feed one comment Id to the action 'Delete Comment'.

Has anyone tried this before?

I've attached screenshot of the automation rule that I've setup.

 

Automation to delete comments.png

Hope experts here can help me out.

WHY I need this automation?

In our project, we have multiple administrative comments by our project manager and due to that actual communication between developers is lost in the comments. Therefore, I would like to delete all the comments done by our project manager once the issue is transitioned to 'Done'

2 answers

Suggest an answer

Log in or Sign up to answer
5 votes
David Foote
Contributor
April 17, 2024

While I'm not sure I philosophically agree with deleting comments, I think you need to use an advanced branch to iterate over the comments.

You also probably don't need to store the comments in a variable, just pass {{issue.comments}} to the branch:

advanced-branching.png

Suraj Gurav April 17, 2024

Thanks for a quick response @David Foote I'm agree with the logic.

However here I have two problems:

  1. I am confused about how to select a single comment id in 'Delete Comment' action. 
  2. Somehow I don't see advanced branching in my Jira project. See the below screenshot.

image.png

Any idea how I can get advanced branching option?

David Foote
Contributor
April 17, 2024

@Suraj Gurav Don't know why I can't reply directly to your post below, 

1. The advanced branch is essentially a loop; when creating the advanced branch you get to define a smart value that you can use in all of the actions of the branch to represent the current item in the list that it is working on (in my example, {{singleComment}} is what I chose for this). So if you have 3 comments; the actions in the branch will execute 3 times and each time through the loop {{singleComment}} will represent a different comment.

2. You may have to click on the Branch rule icon to get the additional options.

Suraj Gurav April 18, 2024

Thanks @David Foote explaining advanced branching in details. It is really helpful.
However, I'm still unable to see 'Advanced Branching' even if I click on 'Branch Rule' component. May be something on the company level, I've already reached out to our company's Jira support team.

Remi DC December 10, 2024

Thanks, it works perfectly !!

0 votes
Matthew Chapman
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.
April 17, 2024

Hi Suraj,

like David below I'm not a fan of deleting data once entered, however if I wanted to keep track of PM comments separate to the development team then I'd recommend looking at a separate/custom text field that only the PM uses.

That keeps developer/PM comments and discussions in different places, so no overlap.

Cheers,

 

Suraj Gurav April 18, 2024

Hi Matthew,

Thanks.

That's an interesting idea, which can probably solve my issue.

I'll check on that.

TAGS
AUG Leaders

Atlassian Community Events