AnsweredAssumed Answered

Task with unknown item is sent to assignee

Question asked by e-no91 on May 8, 2014
Latest reply on May 10, 2014 by e-no91
Based on a post in http://forums.alfresco.com/forum/developer-discussions/workflow/start-workflow-javascript-help-rules-01132008-1106,

I've edited my files:
i) bootstrap-context.xml

                <!– Review and Approve workflow definitions –>
                <props>
                    <prop key="engineId">jbpm</prop>
                    <prop key="location">alfresco/workflow/review_processdefinition.xml</prop>
                    <prop key="mimetype">text/xml</prop>
                    <prop key="redeploy">true</prop>
                </props>


ii) review_processdefinition.xml

<?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>

        <transition name="approve" to="approved" />
</task-node>

    <task-node name="rejected">
        <task name="wf:rejectedTask" swimlane="reviewer" />
        <transition name="" to="end" >
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
var dest = companyhome.childByNamePath(bpm_rejectDestination);
for (var i = 0 ; i &lt; bpm_package.children.length; i++)
{
bpm_package.children.move(dest);
}
</script>
</action>
</transition>
    </task-node>

    <task-node name="approved">
        <task name="wf:approvedTask" swimlane="reviewer" />
        <transition name="" to="end" >
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
var dest = companyhome.childByNamePath(bpm_approveDestination);
for (var i = 0 ; i &lt; bpm_package.children.length; i++)
{
bpm_package.children.move(dest);
}
</script>
</action>
</transition>
    </task-node>

    <end-state name="end" />

</process-definition>


iii) review.js

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:review";
workflow.parameters["bpm:workflowDescription"] = "Sila review dokumen ini";
workflow.parameters["bpm:assignee"] = "us1";
workflow.parameters["bpm:approveDestination"] = "Sites/test-script";
workflow.execute(document);


I get the move my file after approval as I wanted.
The funny thing is, a task with unknown item is sent to assignee us1 everytime after us1 clicks approve during review. The item cannot be accessed at all, as if it has been moved or deleted..
What's happening here?

Is

<prop key="redeploy">true</prop>

line the cause?

EDIT: sorry, posted the wrong processdefinition code.

Outcomes