cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Document Library Action

mduduzi
Confirmed Champ
Confirmed Champ
Hi,

I am using 4.1.4 enterprise version and trying to deploy the Share Backup Action Addon which was created for earlier versions of Alfresco.
I have changed the action registration as follows:

(function()
{
   /**
    * Backup single document.
    *
    * @method onActionBackup
    * @param file {object} Object literal representing one or more file(s) or folder(s) to be actioned
    */    
    YAHOO.Bubbling.fire("registerAction",
    {
        actionName: "onActionBackup",
        fn: function MBP_onActionBackup(file)
      {
            this.modules.actions.genericAction(    
            {
            success:
            {
               message: this.msg("message.backup.success", file.displayName)
            },
            failure:
            {
               message: this.msg("message.backup.failure", file.displayName)
            },
            webscript:
            {
               name: "backup/site/{site}/{container}",
               method: Alfresco.util.Ajax.POST,
               params:
               {
                  site: this.options.siteId,
                  container: this.options.containerId
               }
            },
            config:
            {
               requestContentType: Alfresco.util.Ajax.JSON,
               dataObj:
               {
                  nodeRefs: [file.nodeRef]
               }
            }
         });
      }   
   });
})();


The url defined by the descriptor is
/slingshot/doclib/action/backup/site/{site}/{container} 


I also configured the action in share and declared the js and css dependencies. I have deployed the data webscript in the data dictionary. Now action appears in share with the label and icon defined by the properties file and stylesheet file respectively. The PROBLEM is when the action is clicked I get error generated by the client-side js (Couldn't backup ..) and to me it does not seem to be able to call the webscript. Please help.

Kind regards
2 REPLIES 2

Not applicable
Hi mduduzi,

have you already tried to call the webscript from a REST client? Does this work?
Is the webscript available at the <a href="http://localhost:8080/share/page/index">webscript home</a>?

Greetings chris

mduduzi
Confirmed Champ
Confirmed Champ
Hi Christian,

I finally got it work, for some reason the this functionality worked when deployed as individual file in the share folder. It must be the way I package the jar, which I will have to revisit once I am done with all required extensions.

Thanks for the response

Kind regards