I'm searching for a way to delete all comments of all issues which fulfil a certain JQL statement.
We're using Jira DC 8.20.3 and do not have Script Runner or something similar.
My idea was to do it with Jira automation, by calling the REST API using the action "Send web request".
But as I am a totally beginner regarding Jira automation, Jira REST API and REST API in common, I've got no idea how to begin.
Can anybody help me?
2024-02-01T11:36:04,869 ERROR [common.UserScriptEndpoint]: ************************************************************************************* 2024-02-01T11:36:04,869 ERROR [common.UserScriptEndpoint]: Script console script failed: java.lang.UnsupportedOperationException: Cannot set or mutate an ImmutableGenericValue at com.atlassian.jira.util.ofbiz.ImmutableGenericValue.set(ImmutableGenericValue.java:63) ~[classes/:?] at org.ofbiz.core.entity.GenericEntity.set(GenericEntity.java:283) ~[entityengine-3.0.9.jar:?] at com.atlassian.jira.issue.util.DefaultIssueUpdater.doUpdate(DefaultIssueUpdater.java:79) ~[classes/:?] at com.atlassian.jira.issue.util.DefaultIssueUpdater.doUpdate(DefaultIssueUpdater.java:63) ~[classes/:?] at com.atlassian.jira.issue.comments.DefaultCommentManager.doDelete(DefaultCommentManager.java:483) ~[classes/:?] at com.atlassian.jira.issue.comments.DefaultCommentManager.delete(DefaultCommentManager.java:418) ~[classes/:?] at com.atlassian.jira.issue.comments.CommentManager$delete$5.call(Unknown Source) ~[?:?] at _CSLT.DeleteAUsersComments$_run_closure1$_closure2.doCall(DeleteAUsersComments.groovy:32) ~[?:?] at _CSLT.DeleteAUsersComments$_run_closure1.doCall(DeleteAUsersComments.groovy:29) ~[?:?] at _CSLT.DeleteAUsersComments.run(DeleteAUsersComments.groovy:28) ~[?:?]
You did not explicitly mention if this is something that has to be done on a regular basis and/or in an automated way.
Just to make sure that you are aware of this option:
If you have to do this once or only occasionally, you can just run the query and then bulk edit the results. The option for this can be found behind the three dots (...) on the top right.
Otherwise, I did not test it, but I would assume that this could be an approach:
Screenshot disappeared after I submitted my comment... Trying again:
Failed again...
Copy as text:
This is the result of trying it via automation. It seems that it only works with a certain comment id. In Jira DC 8.20.3 there is no action "Lookup issues" and "Remove comment from issue".
I also know bulk edits, but though the option "Edit issues" with detail "Change comment" makes people think they can change existing comments, it will only add a new comment to the selected issues. So this also won't help me.
Looks like it needs a closing / as in
{{#issue.comments}} {{/}}
See https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/ for more details and explanations
If I do it like you've suggested, I can save the rule, but executing the rule results in an error message:
"Error deleting comment - smart-value did not resolve into a number."
Probably the action "Delete comment" has been designed for single comments only rather than to delete all comments of an issue.
Today I noticed that there is no sense in deleting the comments because users can still see them in the history of the issue.
We wanted to anonymize issues when they are closed for a long time, but not archive or delete them, because of statistical reasons.
So we have to manipulate the database directly anyway.