Used Zammad version: 6.5.2-1766167336.889983bc.bookworm
Used Zammad installation type: .deb package
Operating system: Debian 12 bookworm
Both customers and support staff have created a mess with one or the other ticket, i.e. a ticket has been merged wrongly, another one has been split at a wrong place.
Is there any way for an admin (such as myself) to move articles to the correct place?
Never, ever, fiddle directly inside Zammads database. Youāre bypassing application hooks and checks. This will cause trouble. Donāt do it. If you have to do it, use the rails console.
As this is a dangerous operation and very advanced, I wonāt share how to do it to protect our copy cats. Sorry.
Oh, I see. Iām not used to Rails (weāre a Python shop) at all, so I wouldnāt feel very safe there anyway.
Edit: But there must be some way to delete single articles, right? What am I supposed to do if for some reason an article is in a ticket, that contains information that must be deleted by company policy or by law? Or do I have to delete the complete ticket then? Or split it out and remove the split? No problem, if it is cumbersome, because it does happen not more than once a year
Deletion of tickets/articles is possible, but dangerous and can break your system - best to create a backup first. This solution is not officially supported by Zammad and itās often best to just change the ticketās customer/group to something else, so that only system administrators can see it.
sudo zammad run rails c
Ticket.find(<ticket_id>).articles.pluck(:id, :subject, :created_at) #find article id
article = Ticket::Article.find(12345) #find article
article.attachments.pluck(:id, :filename) #see attachments
article.attachments.each(&:destroy) #delete attachments
article.destroy()
exit
sudo zammad run rake zammad:searchindex:rebuild
Please do not use .destroy ever. Use delete, other wise you skip triggers from the application which is crucerial. This also spares you from reindexingā¦
Also if you remove an article, it will remove attachments too.
You are risking data loss with your code. Please, I didnāt share code for a reason. Yours is highly dangerous.
Thanks for your elaboration! I shared the way I deal with this - and it works. I stated the danger that comes with it.
You only said ādonāt do thatā but thereās no official process (that i know of) to deal with this situation otherwise. Iād greatly appreciate your expert opinion on how to handle this issue in a more stable and reliable way!
But I did? I said use delete instead of destroy and donāt remove attachments manuallyā¦? I gave you an explicit inprovement to lower the danger of your code partly.