Hi all
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
Solved! Go to Solution.
I have found a solution to this. First we copy the document using the .parent property of bpm_package and assign it to a new variable. Then we can remove the original document from bpm_package and add the new one in it's place, as with the following code:
var newdoc = bpm_package.children[0].copy(bpm_package.children[0].parent);
bpm_package.removeNode(bpm_package.children[0]);
bpm_package.addNode(newdoc);
Hi Greg
This is for a workflow within Alfresco (using the activiti engine). I may have got confused about the two categories, but I thought ECM would be mainly for content modelling/structuring and BPM would be for everything workflow related?
I have found a solution to this. First we copy the document using the .parent property of bpm_package and assign it to a new variable. Then we can remove the original document from bpm_package and add the new one in it's place, as with the following code:
var newdoc = bpm_package.children[0].copy(bpm_package.children[0].parent);
bpm_package.removeNode(bpm_package.children[0]);
bpm_package.addNode(newdoc);
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.