CODE WRITTEN BY QUEST KACE SUPPORT FOR DEMONSTRATION PURPOSES ONLY AND NOT SUPPORTED BY KACE TECHNICAL SUPPORT. CLIENT CONFIRMS THE NEED FOR TESTING AND ACCEPTS ALL RESPONSIBILITY FOR USE AND MISUSE OF CODE. QUEST KACE SHALL NOT BE HELD LIABLE FOR DAMAGE OR DOWN TIME RESULTING FROM USE OF THIS OR ANY CODE PRESENTED FOR PURPOSES OF TROUBLESHOOTING OR DEMONSTRATIONIdeally we recommend enabling ticket archival as this will help to make load time for active ticket list much faster. The Ticket archival feature allows to Archive closed tickets older than specified amount of months/years after and to Delete archived tickets older than specified amount of weeks/months/years. Deleting the tickets will release the space occupied by the attachments as well.
But there might be occasions where retaining ticket archive data is required and deleting tickets is not possible, for these type of situations at least deleting the attachments will help to free up some needed space on the SMA.The following queries can be used in a report in order to identify the tickets on both Active ticket table and Archive ticket table:Active tickets with large attachments (showing top 100, this can be adjusted as desired by modifying the limit 100 to any other value)
SELECT T.ID as TICKET_ID, T.HD_QUEUE_ID, T.TITLE, A.FILE_NAME, CONCAT('/kbox/kboxwww/packages/hd_attachments/',TC.ID) as ATTACHMENT_FOUND_IN, A.FILE_SIZE, TC.USER_ID FROM ORG1.HD_TICKET T JOIN HD_TICKET_CHANGE TC ON T.ID = TC.HD_TICKET_ID JOIN HD_ATTACHMENT A ON A.HD_TICKET_CHANGE_ID = TC.ID order by FILE_SIZE desc limit 100;
Archived tickets with large attachments (showing top 100, this can be adjusted as desired by modifying the limit 100 to any other value)
SELECT T.ID as TICKET_ID,T.HD_QUEUE_NAME,T.HD_QUEUE_ID,T.TITLE,A.FILE_NAME,CONCAT('/kbox/kboxwww/packages/hd_attachments/',TC.ID) as ATTACHMENT_FOUND_IN, A.FILE_SIZE,TC.USER_ID FROM ORG1.HD_ARCHIVE_TICKET T JOIN HD_ARCHIVE_TICKET_CHANGE TC on T.ID = TC.HD_TICKET_ID JOIN HD_ARCHIVE_ATTACHMENT A ON A.HD_TICKET_CHANGE_ID = TC.ID order by FILE_SIZE desc limit 100;
Once the ticket is identified it is just a matter of editing the comment with the large attachment to remove it or completely delete the comment.
*** The option for allowing edit/delete comments including attachments would be enabled on the queue

*** Note that for archive tickets, in order to be able to modify or delete the comment containing the large attachment, the ticket needs to be restored so it can be modified then it can be archived back after the large attachment has been taken care.

To delete the attachment:
- Access the ticket detail.
- Locate comment containing the attachment.
- Click on the edit icon (pencil).

- Once the comment is ready for edit, a delete icon (trash can) will be displayed on each file attachment link.

- After clicking the delete icon, it will become underlined and a restore icon will appear.

- Click on save on the comment the save on the ticket to successfully remove the intended file from the ticket.
- If it was an archived ticket, it can archived back from the choose action menu of the ticket.

For any questions or assistance required, Please contact Support.