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">
        <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);
    execution.setVariable('psw_prosegui', false);

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++)

but it doesn't get the dest variable