AnsweredAssumed Answered

variable no definida en review_pooled_processdefinition.xml

Question asked by giorgio on May 15, 2009
Latest reply on Jul 12, 2011 by giorgio
Buenas, amigos tengo un problema al tratar de recoger una variable desde la definicion del proceso del workflow de pooled tasks, para asignarla al metadato del documento en cuestion, sin embargo el codigo que pongo a continuación, en el workflow review de usuario a usuario, ha funcionado perfectamente:

<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:reviewpooled">

    <swimlane name="initiator" />

    <start-state name="start">
        <task name="wf:submitGroupReviewTask" swimlane="initiator" />
        <transition name="" to="review" />
    </start-state>

    <swimlane name="reviewer">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <pooledactors>#{bpm_groupAssignee}</pooledactors>
        </assignment>   
    </swimlane>

    <task-node name="review">
        <task name="wf:reviewTask" swimlane="reviewer">
            <event type="task-create">
                <script>
                   if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                   if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
                </script>
            </event>
            <event type="task-end">
               <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                  <script>
                     <variable name="bpm_assignee" access="write"/>
                     <expression>
                        if (taskInstance.actorId != null)
                           people.getPerson(taskInstance.actorId);
                        else
                           person;
                     </expression>
                  </script>
               </action>
            </event>
        </task>
        <transition name="reject" to="end" />
        <transition name="approve" to="end" />
    <event type="node-enter">
<!– Update the status to Rejected when we enter this task –>
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i &lt; bpm_package.children.length; i++)
{
bpm_package.children.properties["my:prioridad"] = bpm_workflowPriority;
bpm_package.children.properties["my:estado"] = "Pendent";
bpm_package.children.properties["my:tecnico"] = Person;
bpm_package.children.save();
}
</script>
</action>
</event>
    </task-node>

    <task-node name="rejected">
    <event type="node-enter">
<!– Update the status to Rejected when we enter this task –>
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var z = 0; z &lt; bpm_package.children.length; z++)
{
bpm_package.children[z].properties["my:prioridad"] = bpm_workflowPriority;
bpm_package.children[z].properties["my:estado"] = "Rebutjat";
bpm_package.children[z].properties["my:tecnico"] = Person;
bpm_package.children[z].save();
}
</script>
</action>
</event>
        <transition name="" to="end" />
    </task-node>

    <task-node name="approved">
    <event type="node-enter">
<!– Update the status to Aproved when we enter this task –>
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var a = 0; a &lt; bpm_package.children.length; a++)
{
bpm_package.children[a].properties["my:prioridad"] = bpm_workflowPriority;
bpm_package.children[a].properties["my:estado"] = "Aprobat";
bpm_package.children[a].properties["my:tecnico"] = Person;
bpm_package.children[a].save();
}
</script>
</action>
</event>
        <transition name="" to="end" />
    </task-node>

    <end-state name="end" />




si en este trozo de codigo esta dandole valor a esa variable que luego intento acceder

<event type="task-end">
               <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                  <script>
                     <variable name="bpm_assignee" access="write"/>
                     <expression>
                        if (taskInstance.actorId != null)
                           people.getPerson(taskInstance.actorId);
                        else
                           person;
                     </expression>
                  </script>
               </action>

porque al hacer esto:

bpm_package.children.properties["my:tecnico"] = bpm_assignee.properties["cm:userName"];
aunque tambien he probado esto
bpm_package.children.properties["my:tecnico"] = Person;
y esto
bpm_package.children.properties["my:tecnico"] = people.getPerson(taskInstance.actorId);

siempre me dice que bpm_assignee no esta definido?
de que manera tengo que acceder a este tipo de flujo, para poder asignar el nombre de usuario que tomará posesión de la tarea, o coger el nombre del grupo por ejemplo?

Saludos y gracias.

Outcomes