AnsweredAssumed Answered

(solved) Process variables dissapearing?

Question asked by bramthielemans on Jul 31, 2009
Latest reply on Aug 3, 2009 by bramthielemans
Hi

I'm currently experiencing some weird issues with dissapearing process variables in my workflow. Hopefully someone here can help me.

The workflow I created is an approval workflow used by authors and publishers for a wiki-like application (accessible via web scripts).

The general idea is that authors can introduce or modify concepts and attach one or more categories to them. Each category is linked with one or more publishers. For each category on a concept, 1 publisher has to approve the concept. If any publisher rejects the concept, it is sent back to the author so he can make the requested changes and resubmit it. For this I am using a combination of a for-each fork and pooledactors.

Here is the workflow diagram:

[img]http://img188.imageshack.us/img188/8862/processimage.th.jpg[/img]

The problem exists within the start-review node, where I start the for-each fork:

<node name="start-review">
      <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
         <foreach>#{lexicon.selectPooledPublishers(bpm_package.children[0])}</foreach>
         <var>publishers</var>
      </action>
      <transition name="review" to="review" />
</node>

The lexicon object gives me javascript access to some of my own Java functions, such as selectPooledPublishers. This function returns an object (array actually) suitable for using in a pooledactors assignment.

The pooledactors assignment happens in the review tasknode:

<task-node name="review">
      <task name="lexwf:reviewTask">
         <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <pooledactors>#{publishers}</pooledactors>
         </assignment>
      </task>
      <transition name="reject" to="handle-remarks" />
      <transition name="approve" to="end-review" />
</task-node>

I think that's all you need to know, the rest of the workflow does some mailing and approving/rejecting concepts and is working as desired.

Point is, at some point in the workflow the process variables seem to have been dissapeared. More precisely in this scenario:

author         publisher
=================================
1. new/modify concept
               2. reject
3. modify concept
               4. reject
5. modify concept

(note that creating or modifying a concept automatically starts or continues the workflow)

In workflow transitions it would look like this: START -> start-review (1) -> START-REVIEW -> review -> REVIEW -> reject (2) -> HANDLE-REMARKS -> request-review (3) -> START-REVIEW -> review -> REVIEW -> reject (4) -> HANDLE-REMARKS -> request-review (5) -> START-REVIEW

(uppercase = nodes, lowercase = transitions)

When performing steps 3 and 5 the workflow transitions from the handle-remarks task to the start-review node. A mail is also sent during this transition, which completes succesfully for both steps 3 and 5. For step 3 there is no problem at all. For step 5 I get this error:

org.alfresco.scripts.ScriptException: Failed to execute supplied script: ReferenceError: "bpm_package" is not defined. (AlfrescoScript#1)

So the bpm_package process variable cannot be found anymore. I actually had this problem earlier, but was able to solve it by using the <expression> and <variable> tags. But I don't think I can use these when dealing with a org.alfresco.repo.workflow.jbpm.ForEachFork action.

So, does anyone have any ideas/suggestions at all? If more information is needed I'll try to post it asap.

btw, I'm using Alfresco Labs 3Stable


Thanks :)

Outcomes