Missed Team ’24? Catch up on announcements here.

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

Can you delete a comment based on a phrase

Ste404
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 23, 2024

I have an automation rule that puts a comment in a ticket in a panel when a particular SLA starts, this based on a field value being set to true.

What I want to do is delete that comment if the field value is then set back to false.

I cannot be sure that comment is going to be the last comment in the ticket so just can't use that as the mechanism to delete the comment

The panel in the comment has the same title "CANCELLATION REQUESTED"

I have tried this to return the id
{{#issue.comments}}{{#if(exists(body.match("CANCELLATION REQUESTED")))}}{{id}}{{/}}{{/}}

Is there a way to delete a comment in automation that has that in it?

1 answer

0 votes
Ste404
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 23, 2024

ok I have this writing this value in the log
{{#triggerIssue.comments}}{{#if(exists(body.match(".*(CANCELLATION REQUESTED).*")))}} {{id}} {{/}} {{/}}

BUT I need to now turn that into a variable.  Not sure how to do that.

Harsh
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 24, 2024

Hi @Ste404 

Try the following -

Trigger: When Issue Commented

Advance compare condition: 

First value: {{issue.comment}}

condition: contains regular expression 

Regular Expression: CANCELLATION REQUESTED

 

Action: Delete comment

in comment ID field add: {{comment.id}}

 

Save the automation. This should work, I have tested but one drawback, is that the regular expression is case sensitive. So if you are unsure whether it is all upper case or lower case, add both.

 

If it works let please vote

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events