For one of my workflows, I want to be able to select a document in my start task. Then, I would like to execute a script to make a copy of this document in the same folder, and continue the workflow with the new document (if this is possible). I don't have much java experience but I'm trying to achieve something along the lines of:
<script>
var path = bpm_package.children[0].displayPath;
var newdoc = bpm_package.children[0].copy(path);
newdoc.save();
bpm_package = newdoc;
</script>
Any help would be greatly appreciated!
Marcus
Basically the argument in copy function is the object of parent node and not a path to parent node.
So the below code will do the work.
You do not need to call save or any other function after that.Basically this are javascript api of alfresco. You can take a look on below link for more details.
http://docs.alfresco.com/4.1/references/API-JS-Scripting-API.html