cancel
Showing results for 
Search instead for 
Did you mean: 

Document Name Change Rule

bigmclargehuge
Champ in-the-making
Champ in-the-making
Hey Everyone,
I am fairly new to Alfresco, I just deployed the Community edition for testing a few weeks back. We have been using it with some great success. Lets get down to brass tacks.

I am looking to see if there is a way to create a rule that will change the name of a document to contain the variable of the containing folder. For example:

Folder1
-Document readme.txt

run the rule

Folder1
-Folder1 readme.txt


Any information on how that could be accomplished would be great.

Thanks!
2 REPLIES 2

rjohnson
Star Contributor
Star Contributor
Create a Javascript that will rename the document.

It will look something like

var folderName = document.parent.name;
var docName = document.name;
document.name = folderName + " " + docName;
document.save()


Please note I have not tested this script so it may have typos.

Load the script to Repository Data Dictionary / Scripts

Create a rule that executes a script when an item is created

Suggest you make the rule only execute on items that are NOT of type cm:folder.

bigmclargehuge
Champ in-the-making
Champ in-the-making
That was perfect! It pointed me in the right direction I was able to tweak it to my needs.

Thanks again!