Advertisement
briank

Delete All Visible Kartra Helpdesk Tickets

Feb 13th, 2023 (edited)
691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Kartra Bulk Helpdesk Ticket Remover (Use With Extreme Care!)
  2. // Select tickets to delete via filtering, then paste the function below
  3. // and "deleteAllTickets();" (without the quotes) into the console
  4. // (Command + Option + J (Mac) or Control + Shift + J (PC)).
  5. function deleteAllTickets () {
  6. const tickets = [];
  7. const deleteNext = () => {
  8. if (!tickets.length) {
  9. alert('All tickets deleted. Page will now reload.');
  10. location.reload();
  11. } else {
  12. const id = tickets.shift();
  13. console.log('Deleting ticket ' + id);
  14. $.ajax({ url: action_route + '/remove_ticket/' + id }).done(() => setTimeout(deleteNext, 500));
  15. }
  16. };
  17. $('.js_ticket_li').each((ind, el) => tickets.push(el.id.replace(/ticket_/, '')));
  18. if (tickets.length && confirm(`Permanently delete ${tickets.length} ticket(s)?`)) deleteNext();
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement