cancel
Showing results for 
Search instead for 
Did you mean: 

How to override download action in alfresco

hiten_rastogi1
Star Contributor
Star Contributor
Hi,

I want to know how I can override the download action to change its type to a javascript function from link so that I can update a property whenever user tries to download a file in a way that allows downloading along with my custom action ?? Or is there a way where I can achieve both functionality with something else in alfresco ??

P.S. - I know how to override OOTB actions but not sure how to achieve the above.

Thanks
1 REPLY 1

niketapatel
Star Contributor
Star Contributor
Hi,Did you try to simply override download function with type as javascript. I believe it should work.

You can try as below.


  <actions>
         <!– Download document –>
          <action id="document-download" type="javascript" label="actions.document.download">
             <param name="function">onActionDownloadDoc</param>
            <!–
            <param name="href">{downloadUrl}</param>
            <param name="target">_blank</param>
            –>
            <evaluator>evaluator.doclib.action.downloadBrowser</evaluator>
            <evaluator>evaluator.doclib.action.hasContent</evaluator>
         </action>
      
       </actions>


Then define js function in client side js - "onActionDownloadDoc" . I think its action.js please confirm your end.
Generate download URL and also do your custom changes.

And if you want to do explorer side then you may intercept download content servlet request.