---
title: "Delete all comments of an issue."
canonical: "https://support.appfire.com/space/SUPPORT/323584415/Delete%20all%20comments%20of%20an%20issue."
format: markdown
---
This article provides the code snippet to delete all comments of the current issue using [https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=JMWEC&title=Build-your-own%20%28scripted%29%20Post-function](https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=JMWEC&title=Build-your-own%20%28scripted%29%20Post-function) post-function, [callJira](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/465243039) Nunjucks filter, and [this](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-id-delete) Jira Cloud REST API.

## \uD83D\uDCD8 Instructions

1. Navigate to the intended workflow and open it in **Edit** mode.
2. Select the required transition.
3. Select the *Post functions *tab and click `Add post function`.
4. Add the [https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=JMWEC&title=Build-your-own%20%28scripted%29%20Post-function](https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=JMWEC&title=Build-your-own%20%28scripted%29%20Post-function) post-function.
5. Add the below code in “Nunjucks script”:
6. Add the post-function and publish the workflow.

![image](media://2f41df30-a5d9-4548-9043-278a21a25d36)

With this, all the comments on the current issue are deleted when the transition is executed.

> ⚠️ Note that once comments are deleted, they cannot be restored. So please implement this script with caution.

### References

- [Using Nunjucks Templates](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/465503811)
- [Accessing JIRA Standard fields](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/466225701)
- [Tags and Expressions](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/466322168)
- [field filter](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/465373638/Custom+Filters#field)
- [callJira filter](https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/465243039)

## \uD83D\uDCCB Related articles

> Macro (contentbylabel)