AnsweredAssumed Answered

script in workflow review...addAspect()

Question asked by alpha on Mar 1, 2007
Latest reply on Mar 6, 2007 by alpha
hi guys!

i have created a new aspect
<aspect name="my:toggled">
     <title>Toggled</title>
</aspect>
in workflow review definition file, i put a script that apply this aspect to the package. here is the code :
<?xml version="1.0" encoding="UTF-8"?>

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

    <swimlane name="initiator" />

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

    <swimlane name="reviewer">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <actor>#{bpm_assignee}</actor>
        </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>
        </task>
        <transition name="reject" to="rejected"/>
        <transition name="approve" to="approved">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
              <script>
                    for (var i = 0; i &lt; bpm_package.children.length; i++) {
                  logger.log("count bpm_package : "+bpm_package.children.length);
                        bpm_package.children[i].addAspect("my:toggled");
                   }
              </script>
           </action>
      </transition>
    </task-node>

    <task-node name="rejected">
        <task name="wf:rejectedTask" swimlane="initiator" />
        <transition name="" to="end" />
    </task-node>

    <task-node name="approved">
        <task name="wf:approvedTask" swimlane="initiator" />   
        <transition name="" to="end" />
    </task-node>

    <end-state name="end" />

</process-definition>

When i press button approve on a review workflow, the aspect is not applied as i expected it (i have checked with the node navigator).
And nothing is displayed in log file (nor console)?

am i missing something?

PS/ : I need this, to set an evaluator (action evaluator) whether or not to display an action for the bpm_package children.

Outcomes