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?
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.
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
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.