Skip to main content
Closed for Voting

Download all attachments

Related products:Freshdesk
  • October 12, 2016
  • 5 replies
  • 110 views

I found a post here with a .doc file that explained how to add a custom app to allow the downloading of all attachments from a ticket, but it didn't work.


Can this be added as a feature or someone explain how I can get that working?


Pretty standard feature you would think..


thanks in advance

Shane.



5 replies

  • Author
  • Apprentice
  • October 12, 2016

Anyone able to help me out with this? Our Web Team are Agents in our FreshDesk and get multiple attachments in almost every ticket that is sent in for them.

Regards, Shane.


This should work in Chrome:


 

<div id="download_attachments"></div>
<script type="text/javascript">
  jQuery(document).on("ticket_view_loaded", function(event, data) {
    jQuery('#download_attachments').parent().parent().hide();
    jQuery('#original_request .attachments-wrap').after(jQuery('<button id="downalodAttach">Download all attachments</button>'));

    function downloadAttachments() {
      var linkTmp = '';
      var listLink = '';
      var listItems = jQuery('#original_request .attachments-wrap ul li');
      listItems.each(function(pos, liItem) {
        listLink = jQuery(liItem).find('.attach_content a');
        linkTmp = document.createElement('a');
        linkTmp.href = listLink.attr("href");
        linkTmp.download = 'Download.jpg';
        linkTmp.target = '_self';
        document.body.appendChild(linkTmp);
        linkTmp.click();
      });
      document.body.removeChild(linkTmp);
      return false;
    }
    jQuery('#downalodAttach').click(function(event) {
      event.preventDefault();
      downloadAttachments();
    });
  });
</script>

 

In Firefox, it will break if there are images in the attachments or other file types that Firefox insist on displaying itself.

 


  • Author
  • Apprentice
  • October 13, 2016
Thank you Thanos, that worked perfectly in Chrome. Thank you!

 


Forum|alt.badge.img+3

I agree that this should be a native feature!


suprabha.somanathan
Community Debut

Folks,


This is not incorporated as a default feature yet, however, the attachment manager app from our marketplace would help you download all of them in one-go as depicted below - 


image


Cheers!