cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in moving documents using rules

ajaywazir
Champ in-the-making
Champ in-the-making
Hi
We have the following folders in a space:
library
library/books
library/datasheets

all folders have a rule that all incoming content is made versionable (add aspect)
library has two additional  rules
1 all pdf files would be moved to library/books
2 all other files would be moved to library/datasheets
In effect library top level folder would not contain any files

The problem arises when a file with same name as an exisiting file is uploaded to library.
If I upload e.g. zyx.pdf first time to library , it is moved to library/books and assigned v1.0.
If I upload the same file again, there is an error, that a child with duplicate name cannot be created, even if the content has been made versionable.

If I upload the same file directly to folder books, there is same error.

However, If I use Webdav to copy the same file to books folder, it works as desired, archived the originalfile and assigns a new version 1.1 to the newly uploded file



Coupled to above, I want to autmatiacally create new folders based on file names or tags. This use useful, e.g. to file all books by one author in one separate folder. I do not want the end user to create these folders.

Any workaround suggestions???

Thanks
Ajay
3 REPLIES 3

mikef
Champ in-the-making
Champ in-the-making
Rather than use the standard move action, you can create a script that gets run by your rule that has the relevant logic to handle the the move and auto-create of the folders.

See http://wiki.alfresco.com/wiki/JavaScript_API for details on the JavaScript API.

ajaywazir
Champ in-the-making
Champ in-the-making
Hi MIke,
Thanks
Will try.
Is there anyway to pass argruements to scripts?
e.g I would like to pass the name of the destination folder?

Ajay

ajaywazir
Champ in-the-making
Champ in-the-making
Hi
One question ;
using javascript
Is there a way to update content after being checkedout?
I could not find any reference to this; while we can check in and check out, we cannot update;
my application is as follows
Instead of using normal web based check out update file and check in;
I want to automate the process via approval workflow process.

Consider the following scenario:

Drafts folder will have working copies of documents and files would be created or modified via Webdav
Once done, the documents will be sent for approval.
Once approved the documents would be converted to pdf & moved to Approved folder.
Documents would automatically be moved from approved folder to Released Folder using Javascript as discussed above
In Released Folder there would older released versions of same file. So, I would need to check out, update or overwrite and check in
I do not want to lose released document history since this folder would be used to expose read only pdf copies to users with document history


Ajay