- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2019 12:46 PM
I need a script that moves a file to a folder dynamically. The URL of the folder will be registered in a folder's parent property of the file.
The script should take this parameter from the path to where the file should be moved and move it to it. Can someone give me an example of how to do this?
Thanks
- Labels:
-
Alfresco Content Services

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2019 01:15 AM
Hi Renato Fritola,
if you running script as the rule then you will get the document object directly..
var parentNode= document.parent;// getting the parent of the docuemnt var movePath = parentNode.properties["cm:movePath"] //get the path where you want to move from the property// Path should be some thing like this "sites/test/documentLibrary/testFolder" if not then convert something like this..var destination =companyhome.childByNamePath(movePath);document.move(destination);
Plz look in to this bellow links for all the methods and root object you will get in to javascript..
1)Root objects | Alfresco Documentation
2)ScriptNode API | Alfresco Documentation
3)JavaScript API Cookbook
Thanks
Shyam Ghodasra

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2019 01:15 AM
Hi Renato Fritola,
if you running script as the rule then you will get the document object directly..
var parentNode= document.parent;// getting the parent of the docuemnt var movePath = parentNode.properties["cm:movePath"] //get the path where you want to move from the property// Path should be some thing like this "sites/test/documentLibrary/testFolder" if not then convert something like this..var destination =companyhome.childByNamePath(movePath);document.move(destination);
Plz look in to this bellow links for all the methods and root object you will get in to javascript..
1)Root objects | Alfresco Documentation
2)ScriptNode API | Alfresco Documentation
3)JavaScript API Cookbook
Thanks
Shyam Ghodasra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2019 06:15 AM
Worked perfectly!
Thank you.
