AnsweredAssumed Answered

Dynamic assignment using a process variable

Question asked by birgir on Jan 28, 2008
Latest reply on Apr 7, 2009 by robain
Hi

I am having problems with a simple script where I need to store the previous user inorder to assign them the task again if reviewer rejects the work.

I store the username in art_author.

<task-node name="ArtistPool">
   <task name="piwf:artistPool" swimlane="artistPool" />
      
   <transition to="Reader_1" name="Accept">
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
         <script>
            <expression>            
            art_author =  person.properties.userName;
                  
            logger.log("art_author:" + art_author);
            </expression>
            <variable name="art_author" access="write" />
         </script>
      </action>
         
   </transition>
   
</task-node>

In another node I want to assign a task using art_author.


<task-node name="Artist">
      <task name="piwf:artist">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{people.getPerson(art_author)}</actor>
      </assignment>
      </task>
      
      <transition to="Reader_1" name="Accept"></transition>

   </task-node>

I get a nullpointer exception when running this.

Caused by: org.jbpm.graph.def.DelegationException: actor expression '#{people.getPerson(art_author)}' evaluates to null

Havent seen examples where one needs to read in the process variable when using the reference #{}. What am I doing wrong here.

Outcomes