Download all documents from an account

I was looking for this online with no luck so I had to develop itā€¦ :woohoo: :woohoo:

I post my solution here just in case anyone needs itā€¦

Itā€™s a very simple solution and it has some hardcoded strings. It also works for a custom HR module Iā€™m developing, so you can see how to adapt it to work with any moduleā€¦

Itā€™s just a first version and Iā€™m sure it can be improved here and there, butā€¦ I will keep working on it until I make a pull request on thisā€¦

This widget composes a link to a download multiple files javascript with the document ids separated by a | character.

For now, here you haveā€¦

  1. You have to add the widget on the Accounts documents subpanel topButtonsā€¦
    2 => array ( ā€˜widget_classā€™ => ā€˜SubPanelTopExtractDocumentsButtonā€™,
    ā€˜submoduleā€™ => ā€˜Accountsā€™,
    ā€˜relationshipā€™ => ā€˜documentsā€™, ),

  2. Copy the widget on custom/include/generic/sugarWidgets

  3. Copy the javascript into custom/modules/Documents

And thatā€™s it, enjoy it!

1 Like

is it possible to do it for History and Documents subpanel in Leads module? If yes, please explain it to me, How can do it. I want to download all documents in History and Documents subpanel.

Regards,

Well, to download leadsā€™s document you only have to change the first two steps:

  1. You have to add the widget on the Leads documents subpanel topButtonsā€¦
    2 => array ( ā€˜widget_classā€™ => ā€˜SubPanelTopExtractDocumentsButtonā€™,
    ā€˜submoduleā€™ => ā€˜Leadsā€™,
    ā€˜relationshipā€™ => ā€˜leads_documentsā€™, ),

It should workā€¦

But I havenā€™t tried to work with history documentsā€¦