cancel
Showing results for 
Search instead for 
Did you mean: 

Fomulario Workflows y variables

jeferz
Champ in-the-making
Champ in-the-making
Hola!

Estoy intentando crear un workflow muy básico, en el cual, al inicio se le ingresan unos datos y uno de esos datos se vera en todas las siguientes Tareas-Actividades.

La pregunta es como se puede realizar eso? he intentado creando una variable, pero al aparecer no se muestra el campo en una tarea que no tenga definido ese  campo en el modelo de datos.

Saludos y gracias

Pd: por si se animan a mirar la configuración que llevo hasta el momento:
Modelo:

   <types>
      <type name="creowf:iniciarInconsistencia">
         <parent>bpm:startTask</parent>
         <properties>
            <property name="creowf:razon">
               <type>d:text</type>
               <mandatory>true</mandatory>
               <multiple>false</multiple>
            </property>
         </properties>
      </type>
      
      <type name="creowf:revisarInconsistencia">
         <parent>creowf:activitiRevisarInc</parent>
      </type>      
      <type name="creowf:escRevisarInconsistencia">
         <parent>creowf:activitiRevisarInc</parent>
      </type>      
      <type name="creowf:escRevisionFinal">
         <parent>creowf:activitiRevisarInc</parent>
      </type>      
      <type name="creowf:activitiRevisarInc">
      <parent>bpm:activitiOutcomeTask</parent>
      <properties>
         <property name="creowf:approveRejectOutcome">
            <type>d:text</type>
            <default>Escalar</default>
            <constraints>
               <constraint type="LIST">
                  <parameter name="allowedValues">
                     <list>
                        <value>Solucionado</value>
                        <value>Escalar</value>
                     </list>
                  </parameter>
               </constraint>
            </constraints>
         </property>
      </properties>
      <overrides>
      <property name="bpm:packageItemActionGroup">
      <default>read_package_item_actions</default>
      </property>
      <property name="bpm:outcomePropertyName">
      <default>{http://www.creo.com/model/workflow/1.0}approveRejectOutcome</default>
      </property>
      </overrides>
      </type>
   </types>


Worflow process definition:

<process id="inconsistencias" name="Inconsistencias " isExecutable="true">
    <startEvent id="startevent1" name="Start" activiti:formKey="creowf:iniciarInconsistencia"></startEvent>
    <userTask id="revisarInc" name="Revisar Inconsistencia" activiti:candidateGroups="GROUP_REVISORINCONSISTENCIAUNO" activiti:formKey="creowf:revisarInconsistencia">
      <extensionElements>
         <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
            <activiti:field name="script">
               <activiti:string>
                  execution.setVariable('creowf_approveRejectOutcome', task.getVariable('creowf_approveRejectOutcome'));
               
               </activiti:string>
            </activiti:field>
         </activiti:taskListener>
         <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
            <activiti:field name="script">
               <activiti:string>
                  execution.setVariable('creowf_razon', task.getVariable('creowf_razon'));
               
               </activiti:string>
            </activiti:field>
         </activiti:taskListener>
      </extensionElements>   
   </userTask>
   
    <exclusiveGateway id="decision1" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="escalarOFinalizar" sourceRef="revisarInc" targetRef="decision1"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="finalizar" sourceRef="decision1" targetRef="endevent1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${creowf_approveRejectOutcome == 'Solucionado'}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="revisarInc2" name="Esc Revisar Inconsistencia" activiti:candidateGroups="GROUP_ESCREVISORDOS" activiti:formKey="creowf:escRevisarInconsistencia"></userTask>
    <sequenceFlow id="escalarUno" sourceRef="decision1" targetRef="revisarInc2">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${creowf_approveRejectOutcome == 'Escalar'}]]></conditionExpression>
    </sequenceFlow>
    <exclusiveGateway id="decision2" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="escalarOFinalizarDos" sourceRef="revisarInc2" targetRef="decision2"></sequenceFlow>
    <sequenceFlow id="finalizarDos" sourceRef="decision2" targetRef="endevent1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${creowf_approveRejectOutcome == 'Solucionado'}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="revisarInc3" name="Esc Revision Final" activiti:candidateGroups="GROUP_ESCREVISORFINAL" activiti:formKey="creowf:escRevisionFinal"></userTask>
    <sequenceFlow id="escalarDos" sourceRef="decision2" targetRef="revisarInc3">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${creowf_approveRejectOutcome == 'Escalar'}]]></conditionExpression>
    </sequenceFlow>
    <endEvent id="endevent2" name="End"></endEvent>
    <sequenceFlow id="finFlujo" sourceRef="revisarInc3" targetRef="endevent2"></sequenceFlow>
    <sequenceFlow id="flowInicio" sourceRef="startevent1" targetRef="revisarInc"></sequenceFlow>
  </process>


y finalmente la configuración del formulario en share:

   <config evaluator="string-compare" condition="activiti$inconsistencias">
    <forms>
       <form>
          <field-visibility>
             <show id="bpm:workflowDescription" />
             <show id="packageItems" />
             <show id="creowf:razon" />
             <show id="transitions" />
          </field-visibility>
          <appearance>
            <set id="" appearance="title" label-id="workflow.set.general" />
            <set id="items" appearance="title" label-id="workflow.set.items" />
            <set id="other" appearance="title" label-id="workflow.set.other" />
            <set id="response" appearance="title" label-id="workflow.set.response" />
            <field id="bpm:workflowDescription" label-id="workflow.field.message">
               <control template="/org/alfresco/components/form/controls/textarea.ftl" >
                  <control-param name="style">width: 95%</control-param>
               </control>
            </field>
            <field id="packageItems" set="items" />
            <field id="creowf:razon" set="response" />
            <field id="transitions" set="response" />
         </appearance>
      </form>
   </forms>
</config>
      
   <config evaluator="task-type" condition="creowf:activitiRevisarInc">
      <forms>
         <form>
            <field-visibility>
               <show id="bpm:workflowDescription" />
               <show id="packageItems" />
               <show id="creowf:approveRejectOutcome" />
             <show id="creowf:razon" />
               <show id="transitions" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.general" />
               <set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
               <set id="assignee" appearance="title" label-id="workflow.set.assignee" />
               <set id="items" appearance="title" label-id="workflow.set.items" />
               <set id="response" appearance="title" label-id="workflow.set.response" />
              
               <field id="bpm:workflowDescription" label-id="workflow.field.message">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
                  </control>
               </field>
               <field id="packageItems" set="items" />
               <field id="creowf:approveRejectOutcome" set="response" />
            <field id="creowf:razon" set="response" />
               <field id="transitions" set="response" />              
            </appearance>
         </form>
      </forms>
    </config>
   
   <config evaluator="task-type" condition="creowf:revisarInconsistencia">
      <forms>
         <form>
            <field-visibility>
               <show id="bpm:workflowDescription" />
               <show id="packageItems" />
            <show id="creowf:razon" />
               <show id="creowf:approveRejectOutcome" />
               <show id="transitions" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.general" />
               <set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
               <set id="assignee" appearance="title" label-id="workflow.set.assignee" />
               <set id="items" appearance="title" label-id="workflow.set.items" />
               <set id="response" appearance="title" label-id="workflow.set.response" />
              
               <field id="bpm:workflowDescription" label-id="workflow.field.message">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
                  </control>
               </field>
               <field id="packageItems" set="items" />
               <field id="creowf:approveRejectOutcome" set="response" />              
            <field id="creowf:razon" set="response" />
               <field id="transitions" set="response" />              
            </appearance>
         </form>
      </forms>
    </config>

    <config evaluator="task-type" condition="creowf:escRevisarInconsistencia">
      <forms>
         <form>
            <field-visibility>
               <show id="bpm:workflowDescription" />
            <show id="creowf:razon" />
               <show id="packageItems" />
               <show id="creowf:approveRejectOutcome" />
               <show id="transitions" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.general" />
               <set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
               <set id="assignee" appearance="title" label-id="workflow.set.assignee" />
               <set id="items" appearance="title" label-id="workflow.set.items" />
               <set id="response" appearance="title" label-id="workflow.set.response" />
              
               <field id="bpm:workflowDescription" label-id="workflow.field.message">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
                  </control>
               </field>
               <field id="packageItems" set="items" />
            <field id="creowf:razon" set="response" />
               <field id="creowf:approveRejectOutcome" set="response" />              
               <field id="transitions" set="response" />              
            </appearance>
         </form>
      </forms>
    </config>
   
    <config evaluator="task-type" condition="creowf:escRevisionFinal">
      <forms>
         <form>
            <field-visibility>
               <show id="bpm:workflowDescription" />
               <show id="packageItems" />
            <show id="creowf:razon" />
               <show id="creowf:approveRejectOutcome" />
               <show id="transitions" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.general" />
               <set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
               <set id="assignee" appearance="title" label-id="workflow.set.assignee" />
               <set id="items" appearance="title" label-id="workflow.set.items" />
               <set id="response" appearance="title" label-id="workflow.set.response" />
              
               <field id="bpm:workflowDescription" label-id="workflow.field.message">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
                  </control>
               </field>
               <field id="packageItems" set="items" />
            <field id="creowf:razon" set="response" />
               <field id="creowf:approveRejectOutcome" set="response" />              
               <field id="transitions" set="response" />              
            </appearance>
         </form>
      </forms>
    </config>

1 REPLY 1

mondar
Champ in-the-making
Champ in-the-making
Si lo que quieres por ejemplo es pasar el campo "creowf:razon" del evento Start a la usertask revisarInc deberás hacer un aspect.

En el modelo deberías poner algo similar a esto:

<blockcode>

<types>
   <type name="creowf:iniciarInconsistencia">
         <parent>bpm:startTask</parent>
    <mandatory-aspects>
           <aspect>scwf:myAspect</aspect>
         </mandatory-aspects>
   </type>

…….
</types>

<aspects>

<aspect name="scwf:myAspect">
     <title>My Aspect</title>
     <properties>
        <property name="creowf:razon">
      <type>d:text</type>
           <mandatory>true</mandatory>
           <multiple>false</multiple>
   </property>
     </properties>
</aspect>

…..

</aspects>
</blockcode>