Create automatically folders
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2011 04:19 AM
There any way to create automatically subfolders in the user's folder when I create this user??? Rules, scripts, etc…
Thanks!
Thanks!
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2011 05:13 AM
I've progressed a bit, I created a rule that runs when the folder is created, this rule calls the next script:
I take this code from the file docActions.get.js. But when I run I get an error, and looking at the firebug gives me the next answer:
Any idea?
resultString = "create_space.failed";var parentNodeId = 'User Homes/',spaceName = 'facturas',spaceTitle = "Carpeta de pruebas" ,spaceDescription = "Descripcion de la carpeta de pruebas" templateId = '';var nodeNew;if ((spaceName == null) || (spaceName == "")){ resultString = "create_space.missing_name";}else{ var nodeParent = search.findNode("workspace://SpacesStore/" + parentNodeId); // Copy from template? if ((templateId != null) && (templateId != "")) { nodeTemplate = search.findNode("workspace://SpacesStore/" + templateId); nodeNew = nodeTemplate.copy(nodeParent, true); nodeNew.name = spaceName; } else { nodeNew = nodeParent.createFolder(spaceName); } // Always add title & description, default icon nodeNew.properties["cm:title"] = spaceTitle; nodeNew.properties["cm:description"] = spaceDescription; nodeNew.properties["app:icon"] = "space-icon-default"; nodeNew.save(); // Add uifacets aspect for the web client nodeNew.addAspect("app:uifacets"); if (nodeNew != null) { resultString = "space_created"; resultCode = true; }}
I take this code from the file docActions.get.js. But when I run I get an error, and looking at the firebug gives me the next answer:
"exception" : "org.alfresco.scripts.ScriptException - 04100119 Failed to execute script 'workspace:\/\/SpacesStore\/6b697df7-38b1-4a87-804d-5426c80d8b1c': 04100118 TypeError: Cannot call method \"createFolder\" of null (workspace:\/\/SpacesStore\/6b697df7-38b1-4a87-804d-5426c80d8b1c#29)",
Any idea?
