cancel
Showing results for 
Search instead for 
Did you mean: 

move files to particular space using advanced workflow?

kiran1
Champ in-the-making
Champ in-the-making
Hi
Iam using alfresco 1.4,
Through rules i can able to move files from one space to another space.How to do the same thing using advanced workflow?

(i can able to assign file to another user,but when he approves it,it has to be moved to particular space,how to do this?).

Thanks in advance
kiran
4 REPLIES 4

anil
Champ in-the-making
Champ in-the-making
I am using alfresco 2.1 and I moved the files into various spaces using following script :-


var src = companyhome.childByNamePath("Main/Sales/RFP For Approval/"+wf_projectTitle);
        var dest = companyhome.childByNamePath("Main/Sales/RFP InProcess");

       var mydate = new Date();
      var enquiryFolder = dest.childByNamePath(wf_projectTitle);
      if (enquiryFolder != null)
      {
       enquiryFolder.name = enquiryFolder.name+mydate.toString().substring(3,24).replace(/:/g,"_");
      }

        for (var i = wf_filescounter;bpm_package.children.length > i; i++)
        {
        bpm_package.children.move(src);
        }

Hope this will help u

kiran1
Champ in-the-making
Champ in-the-making
Thanks for your reply anil

can u elaborate it please…
means whether i have to create new js file or whether i have add thisone
in any js file.if so,how to call this script?Form which file?

Thanks in advance
kiran

rob562435
Champ in-the-making
Champ in-the-making
The way to do this is to add so called actions to your advanced workflow in the process definition file. The action itself may move the files around:

   <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
    <script>
     var ccrArchivedSpace = companyhome.childByNamePath("CCR repository/Archived files");
     bpm_package.children[0].move(ccrArchivedSpace);
     if (bpm_package.children.length &gt; 1)
      for (var i = 1; i &lt; bpm_package.children.length; i++)
       bpm_package.children[i].move(ccrArchivedSpace);
    </script>
   </action>
See the advanced workflow help on how to add actions.
The action in my example does the following:
First declares a variable to be the destination space.
Next it moves the primary file of the workflow package (the one you start the advanced workflow on) to the new destination. Then, in case there are more files in the workflow package, move all other files to the new location as well one by one.
Hope this helps to clarify…
This action can be added to a transition or to any event.

kiran1
Champ in-the-making
Champ in-the-making
Thanks rob562435 for your reply.


kiran