cancel
Showing results for 
Search instead for 
Did you mean: 

parameters transition within tasks

davidedge
Champ in-the-making
Champ in-the-making
Hi,
i'm developing a custom workflow(with activiti). I have a problem:

    <serviceTask id="alfrescoScripttask1" name="fornisce elenco aziende" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">       <extensionElements>           <activiti:field name="script">            <activiti:string>                              var tag = "sigima";                  var taggedNodes = companyhome.childrenByTags(tag);                     var aziende= new Array();                  for(var i=0; taggedNodes.length; i++){                     aziende=taggedNodes.name;                                       }                                          </activiti:string>         </activiti:field>           </extensionElements>   </serviceTask>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


ChildrenByTags API return an array of ScriptNode and i want to store the name of every node in aziende(array).After this, i want to hand this array to following user-task for printing it.
How can i do? Can i hand an array? Or can i only hand a single variable?
7 REPLIES 7

muralidharand
Star Contributor
Star Contributor
Hi,
You can the array of script nodes into a workflow variable, then you can use it in the following user task.

Hope this helps you.


davidedge
Champ in-the-making
Champ in-the-making
Thanks for your response,
i have another questions: can i report array elements in my model content custom? I want to visualize name property of every node.

      <aspect name="wf:aziendeScelte">         <properties>            <property name="wf:taggedNodes[0].name">               <type>d:text</type>            </property>            <property name="wf:taggedNodes[1].name">               <type>d:text</type>            </property>         </properties>      </aspect>‍‍‍‍‍‍‍‍‍‍‍‍‍


Can i write this? And how can i do whether i don't know the array's length?

davidedge
Champ in-the-making
Champ in-the-making
Thanks for your response,
i have another questions: can i report array elements in my model content custom? I want to visualize name property of every node.

<code>

      <aspect name="wf:aziendeScelte">
         <properties>
            <property name="wf:taggedNodes[0].name">
               <type>d:text</type>
            </property>
            <property name="wf:taggedNodes[1].name">
               <type>d:text</type>
            </property>
         </properties>
      </aspect>
</node>

Can i write this?

Hi,

You dont know the size of tags, so to implement this have a single property with multiple values enabled. as below
<aspect name="wf:aziendeScelte">         <properties>            <property name="wf:taggedNodesNames">               <type>d:text</type>                                        <multiple>true</multiple>            </property>                     </properties>      </aspect>‍‍‍‍‍‍‍‍‍‍‍

davidedge
Champ in-the-making
Champ in-the-making
What's "wf:taggedNodesNames" ? In this way could i see property name every node of array?

yes

davidedge
Champ in-the-making
Champ in-the-making
Don't work: i don't visualize names of ScriptNode array in the following task.

     <serviceTask id="alfrescoScripttask1" name="fornisce elenco aziende" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">       <extensionElements>           <activiti:field name="script">            <activiti:string>                              var tag = "collaborazione";                  var wf_taggedNodes = companyhome.childrenByTags(tag);                     execution.setVariable('wf_taggedNodes','wf_taggedNodes');                                                    </activiti:string>         </activiti:field>      </extensionElements>‍‍‍‍‍‍‍‍‍‍‍‍‍


       <type name="wf:sceltaAzienda">         <parent>bpm:workflowTask</parent>            <mandatory-aspects>               <aspect>wf:aziendeScelte</aspect>               <aspect>wf:ordineInfoCollaborazione</aspect>                           </mandatory-aspects>      </type>      <aspect name="wf:aziendeScelte">         <properties>            <property name="wf:taggedNodesNames">               <type>d:text</type>                        <multiple>true</multiple>            </property>         </properties>      </aspect>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


   <config evaluator="task-type" condition="wf:sceltaAzienda">      <forms>         <form>            <field-visibility>               <show id="wf:aziendeScelte" />               <show id="bpm:assignee" />               <show id="wf:tipoOrdineColl" />               <show id="wf:tempoPagamentoColl" />               <show id="packageItems" />               <show id="transitions" />            </field-visibility>            <appearance>               <set id="aziende" appearance="title" label-id="Aziende selezionate" />               <set id="assignee" appearance="title" label-id="workflow.set.assignee" />               <set id="other" appearance="title" label-id="Dettagli ordine" />               <set id="items" appearance="title" label-id="workflow.set.items" />               <set id="response" appearance="title" label-id="workflow.set.response" />               <field id="wf:aziendeScelte" label="azienda" set="aziende" >                  <control template="/org/alfresco/components/form/controls/info.ftl" />               </field>               <field id="bpm:assignee" label="workflow.field.assign_to" set="assignee" />               <field id="wf:tipoOrdineColl" label="Tipo ordine" set="other" />               <field id="wf:tempoPagamentoColl" label="Tempo pagamento" set="other" />               <field id="packageItems" label="Specifica del prodotto" set="items" />               <field id="transitions" set="response" />            </appearance>         </form>      </forms>      </config>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍