title: Move an attached to a task document to another node
body: <p>Greetings to the community, I am using alfresco 6.0.0 Community Edition and I would like to move a document attached to a task to another node on the complete event of the task.</p>
  
  <p>I found from here  <a href="https://community.alfresco.com/thread/204737-workflow-parallel-group-review-with-move" rel="nofollow noreferrer">https://community.alfresco.com/thread/204737-workflow-parallel-group-review-with-move</a>  about this "move" function so what I am currently doing is the following:</p>
  
  <ol>
  <li>Start the process</li>
  <li>Attach an item to the task that I have created using the </li>
  </ol>
  
  <blockquote>
    <p>/tasks/{taskId}/items (POST) 
    method of the alfresco REST API.</p>
  </blockquote>
  
  <ol start="3">
  <li>Complete the task </li>
  </ol>
  
  <p>The part of my bpmn where I move the file is below:</p>
  
  <pre><code>&lt;activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener"&gt;
                &lt;activiti:field name="script"&gt;
                   &lt;activiti:string&gt; 
  
                     java.lang.System.out.println(bpm_package.children.length);
                      for (var i = 0; i &amp;lt; bpm_package.children.length; i++){
                       bpm_package.children.move("b162be92-fb36-44f0-83c1-4432b8261c5a");
                      }
                   &lt;/activiti:string&gt;
                &lt;/activiti:field&gt;
             &lt;/activiti:taskListener&gt;
  </code></pre>
  
  <p>Where <strong>b162be92-fb36-44f0-83c1-4432b8261c5a</strong> is the node id of a folder I have created.</p>
  
  <p>Unfortunately, when i complete this task I get the following error:</p>
  
  <blockquote>
    <p>Node Type: {<a href="http://www.alfresco.org/model/content/1.0" rel="nofollow noreferrer">http://www.alfresco.org/model/content/1.0</a>}content, Node Aspects: [{<a href="http://www.alfresco.org/model/content/1.0" rel="nofollow noreferrer">http://www.alfresco.org/model/content/1.0</a>}auditable, {<a href="http://www.alfresco.org/model/system/1.0" rel="nofollow noreferrer">http://www.alfresco.org/model/system/1.0</a>}referenceable, {<a href="http://www.alfresco.org/model/system/1.0" rel="nofollow noreferrer">http://www.alfresco.org/model/system/1.0</a>}localized]
    0.0
    2018-11-15 15:43:24,936  ERROR [impl.interceptor.CommandContext] [http-apr-8080-exec-3] Error while closing command context
     org.activiti.engine.ActivitiException: Exception while invoking TaskListener: Exception while invoking TaskListener: 10150807 Failed to execute supplied script: 10150806 TypeError: Cannot find function move in object Node Type: {<a href="http://www.alfresco.org/model/content/1.0" rel="nofollow noreferrer">http://www.alfresco.org/model/content/1.0</a>}content, Node Aspects: [{<a href="http://www.alfresco.org/model/content/1.0" rel="nofollow noreferrer">http://www.alfresco.org/model/content/1.0</a>}auditable, {<a href="http://www.alfresco.org/model/system/1.0" rel="nofollow noreferrer">http://www.alfresco.org/model/system/1.0</a>}referenceable, {<a href="http://www.alfresco.org/model/system/1.0" rel="nofollow noreferrer">http://www.alfresco.org/model/system/1.0</a>}localized]. (AlfrescoJS#10)
            at org.activiti.engine.impl.persistence.entity.TaskEntity.fireEvent(TaskEntity.java:742)
            at org.activiti.engine.impl.persistence.entity.TaskEntity.complete(TaskEntity.java:184)
            at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:52)
            at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:24)
            at org.activiti.engine.impl.cmd.NeedsActiveTaskCmd.execute(NeedsActiveTaskCmd.java:59)
            at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
            at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
            at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
            at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)
            at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
            at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
            at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
            at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
            at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:178)
            at org.alfresco.rest.workflow.api.impl.TasksImpl.update(TasksImpl.java:821)
            at sun.reflect.GeneratedMethodAccessor1556.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)</p>
  </blockquote>
  
  <p>Could anyone shed light on this please? Any help is greatly appreciated :) </p>