11-19-2016 11:29 AM
I've three associations added to the workflow's form by an aspect:
<aspect name="psw:allegabile">
               <associations>
                    <association name="psw:docDRC">
                         <title>Domanda di Ricostruzione di Carriera</title>
                         <source>
                              <mandatory>true</mandatory>
                              <many>false</many>
                         </source>
                         <target>
                              <class>cm:content</class>
                              <mandatory>true</mandatory>
                              <many>false</many>
                         </target>
                    </association>
                    <association name="psw:docAS">
                         <title>Autocertificazione dei Servizi</title>
                         <source>
                              <mandatory>true</mandatory>
                              <many>false</many>
                         </source>
                         <target>
                              <class>cm:content</class>
                              <mandatory>true</mandatory>
                              <many>false</many>
                         </target>
                    </association>
                    <association name="psw:docAllegati">
                         <title>Documenti allegati</title>
                         <source>
                              <mandatory>false</mandatory>
                              <many>true</many>
                         </source>
                         <target>
                              <class>cm:content</class>
                              <mandatory>false</mandatory>
                              <many>true</many>
                         </target>
                    </association>
               </associations>
          </aspect>I need to move the documents between folders during the workflow. The move function works for the mandatory associations but I can't find how to check if psw:docAllegati is empty. Any idea?
11-20-2016 06:05 AM
Ok, maybe I found a solution, but it still gives me an error. This time says:
org.alfresco.scripts.ScriptException: 10200004 Failed to execute supplied script: missing ) after condition (AlfrescoJS#5)
I checked the code but I can't see any missing )
<userTask id="approvaDRC" name="Approva Domanda di Ricostruzione di Carriera" activiti:formKey="psw:activitiApprovaDRC">
         <extensionElements>
              <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">  
                    <activiti:field name="script">  
                         <activiti:string>  
                                <![CDATA[if(task.getVariableLocal('psw_esitoValutazioneDRC') == 'Approvata'){
                             execution.setVariable('psw_proseguiDRC', true);
                              var dest = companyhome.childByNamePath("/Ragionerie dello Stato");
                              psw_docDRC.move(dest);
                              psw_docAS.move(dest);
                              if(psw_docAllegati.children.length > 0){
                                       for(var i = 0; i < psw_docAllegati.children.length; i++ ){
                                       psw_docAllegati.children[i].move(dest);
                                       }
                                  }
                             }else{
                             execution.setVariable('psw_proseguiDRC', false);
                             }]]>
                         </activiti:string>  
                    </activiti:field>
                    <activiti:field name="runAs">
                         <activiti:string>admin</activiti:string>
                    </activiti:field>  
               </activiti:taskListener>
         </extensionElements>
         <humanPerformer>
                <resourceAssignmentExpression>
                    <formalExpression>${bpm_assignee.properties.userName}</formalExpression>
                </resourceAssignmentExpression>
        </humanPerformer>
    </userTask><sequenceFlow id="flow1" sourceRef="startevent1" targetRef="protocollaDRC">
         <extensionElements>
              <activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
                   <activiti:field name="script">
                        <activiti:string>
                             <![CDATA[
                                  var gruppo = bpm_groupAssignee.properties["cm:authorityName"];
                                  var dest = companyhome.childByNamePath("/"+gruppo);
                                   psw_docDRC.move(dest);
                                  psw_docAS.move(dest);
                                  if (psw_docAllegati.children.length > 0){
                                       for (var i = 0; i < psw_docAllegati.children.length; i++){
                                            psw_docAllegati.children[i].move(dest);
                                       }
                                  }]]>
                        </activiti:string>
                   </activiti:field>
              </activiti:executionListener>
         </extensionElements>
    </sequenceFlow> 
					
				
				
			
		
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.