Reputation: 131
I have the folder DEPARTMENT created as a folder model in Data Dictionary/Space Template as follows:
I want when i create a folder based on the Template folder (DEPARTMENT) and rename it (to the proper name department) to automatically rename the child folder.
Example:
HR/Client_HR
How can i do that? How can I apply a script to a folder and not a document?
Upvotes: 0
Views: 473
Reputation: 188
While you can do this with a folder rule, in general, I'd suggest using a behavior (see http://docs.alfresco.com/6.1/references/dev-extension-points-behaviors.html). You could have a custom folder type for your template and then bind the onCreateNode event for your folder type. Jeff Potts has a good tutorial on this too on his ecmarchitect.com site (go here for the behavior one directly - https://ecmarchitect.com/alfresco-developer-series-tutorials/behaviors/tutorial/tutorial.html)
Upvotes: 1
Reputation: 2246
You could simply write your code as a rule using the JavaScript API, and apply that rule to the template folder. When defining this rule, you can choose to apply it only to folders with a bunch of others options.
When you create a folder based on this template, the rule will also be copied along and executed.
https://docs.alfresco.com/5.1/tasks/library-folder-rules-define-create.html
Upvotes: 2