AnsweredAssumed Answered

How can I extend a taskListener to move a document?

Question asked by mafaldap on Oct 21, 2016
Latest reply on Nov 4, 2016 by mafaldap

I need to move an approved document from one folder to the initiator home page folder. I think that I can do it from the workflow's task, adding script to this:

 

<userTask id="valutaCSS" name="Valuta Certificato di Servizio (semplice)" activiti:formKey="psw:activitiValutaCS">
      <extensionElements>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[if(task.getVariableLocal('psw_esitoValutazioneCS') == 'Approvato'){
    execution.setVariable('psw_prosegui', true);
    }else{
    execution.setVariable('psw_prosegui', false);
    }]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
      <humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${bpm_assignee.properties.userName}</formalExpression>
                </resourceAssignmentExpression>
            </humanPerformer>
    </userTask>

I tried to change this code for a simple test:

var dest = companyhome.childByNamePath("Repository/Simulazioni");
for (var i = 0; i < bpm_package.children.length; i++)
{
  bpm_package.children[i].move(dest);
}

but it doesn't get the dest variable

Outcomes