cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic assignment using a process variable

birgir
Champ in-the-making
Champ in-the-making
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.
10 REPLIES 10

robain
Champ in-the-making
Champ in-the-making
found what the problem was with my code. i had javascript comments "//" lines within the code. everything works fine once I remove them.

Thanks