cancel
Showing results for 
Search instead for 
Did you mean: 

create space dynamically while uploading file

nikes
Champ on-the-rise
Champ on-the-rise
Hello folks,

How can I implement dynamic space creation while uploading a document?

I want to store Loan Applicant's group of documents.
First I upload Application form and I enter value in custom property "Application Number". Now I want to create folder with name of Application Number(which should be created by Alfresco automatically by picking Application Number I enter). Thus system will have different space/folder for different applicants.

I know how to write Javascript API to simply create  new folder based on timestamp, but I am not able to achieve above scenario.

Thanks in advance for any help,
Nikesh
5 REPLIES 5

jpotts
World-Class Innovator
World-Class Innovator
When you have a requirement that sounds like, "Do this automatically when a document is added/updated/deleted," you should be thinking "rule action". To do what you are describing, I'd create a custom action that:

1. Inspects the Application Number property
2. Creates a new folder named using that property value (after checking to see if it already exists)
3. Moves the freshly-uploaded document into the new folder

I would then create a rule in the parent folder that triggers the action any time a new document was placed in the folder.

If applications can live in any folder in the repository, you might consider using a behavior bound to the application type instead of a rule action to avoid having to configure the rule all over the place, but if it is a handful of folders, stick with the rule action to keep it simple.

To learn more about creating custom actions, check out the free tutorial on creating custom actions at http://www.ecmarchitect.com/images/articles/alfresco-actions/actions-article.pdf or refer to Chapter 4 in the Alfresco Developer Guide book.

Jeff

nikes
Champ on-the-rise
Champ on-the-rise
Thanks Jeff,

Instead of writing Java action, I wrote JavaScript action and applied rule on update event.
So no need to compile java program.

Can anyone tell me, In what scenario we have to write custom Java action that we can not do using JavaScript action?

Thanks,
Nikesh

jpotts
World-Class Innovator
World-Class Innovator
The first criteria is going to be "can the XXX API do what I need to do". The JavaScript and Java APIs are not at the same level. Obviously, the Java API, appropriately called the "foundation API", can do anything. The JavaScript API is catching up. A good example is workflow. A lot has been done to enhance the JavaScript API around workflow but there are still things you may need to do that require Java.

Jeff

noesanchez68
Champ in-the-making
Champ in-the-making
hola  he creado un espacio desde java, pero no me permite agregar un elemento desde java
al archivo creado desde java alguien me podria ayudar

lista
Star Contributor
Star Contributor
You really should use English if you expect people to help you Smiley Happy