cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create a Folder with Custom Property using WebScript

satheeshkumar
Champ in-the-making
Champ in-the-making
Hi,

I would like to create a folder in Alfresco Share, during creation I should be able to set some custom property associated to it.

For Example,
My custom webscript should allow me to give inputs for the "folder name" and a property "prefix".
After giving these details and clicking on "Save" or "Submit" whatever, it should create a folder in two different places(based on the parent nodeRef configured in the webscript) with the given name and associate the "prefix" property with the value given.

Can someone guide me on how to do this. I am pretty new to AIKAU Widgets, gone the several tutorials but could not find a way to do this.

Thanks in Advance,
Satheesh
2 REPLIES 2

s_palyukh
Star Contributor
Star Contributor
I think you don't need to use AIKAU…

I believe would be better to make custom action that will do everything what you want. Take a look at this post http://www.marversolutions.com/wordpress/2012/04/15/adding-document-library-actions-in-alfresco-4-0/

muralidharand
Star Contributor
Star Contributor
Hi Satheesh,


Please look at the below method on crudservice.js file.



onCreate: function alfresco_services_CrudService__onCreate(payload) {
      
         var url = this.getUrlFromPayload(payload);
         this.serviceXhr({url: url,
                          data: this.clonePayload(payload),
                          method: "POST",
                          successMessage: payload.successMessage,
                          alfTopic: payload.alfResponseTopic,
                          successCallback: this.refreshRequest,
                          callbackScope: this});
      }


The above is used to create a node (file/ folder) in a given destination node reference.

I believe you might need to do the request two times for each different destinations.

Simplest way,you can use folder rules in the destination folder, whenever there is a folder is created, create an another folder in the new location also. In this case, you no need to create anything extra code, mostly goes in the configuration side.

Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.