cancel
Showing results for 
Search instead for 
Did you mean: 

Set Task Assignee based on package assoc to user

boneill
Star Contributor
Star Contributor
Hi All,

I have  a custom workflow that has a review and approve task.  Each task needs to be carried out by a different user.

We have created our own custom task that has an additional aspect for the approver.  The user can set the reviewer (bpm_assignee) and approver (wf_approver) on the start task.  The review task has access to the bpm_assignee variable for assignment but the approval task cannot get any value for wf_approver. 

What is the correct way to allow a user to set both a reviewer and approver as two seperate people from the start task.

Regards
2 REPLIES 2

amitabhandari1
Champ in-the-making
Champ in-the-making
Hi,

You can set the value in the starttask of  process definition.
Use  executionContext.setVariable("bpm_assignee","abc"); 
Use  executionContext.setVariable("wf_approver,"xyz"); 

Below snippet is given:
<start-state name="start">
    <task name="XXXX" swimlane="initiator" >
          <event type="task-end">
               <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                  <script>
                   executionContext.setVariable("wf_approver,"xyz"); 
                       executionContext.setVariable("bpm_assignee","abc");
                  </script>
       </action>
          </event>
</task>

When you have to use these values you can put as mentioned below in review task.
  <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
               <actor>#{wf_approver}</actor>
      </assignment>
     </event>

Thanks,

boneill
Star Contributor
Star Contributor
Thanks Amita,

I am using activiti.  Do you know if you can do the same in activiti.

BTW, I found a solution as follows:

The start task model type had two mandatory aspects, bpm_assignee and wf_approver, each of which are associations to person.
Each subsequent task had to also include these as mandatory aspects in their content type model.  That was the piece we were missing.  The workflow passes the set bpm_assignee and wf_approver values from the start task through to the other tasks so long as the other tasks also include them as mandatory aspects in their model types.

Regards