cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign user to task

tiennd
Champ in-the-making
Champ in-the-making
Please take a look at my process definition and task model below:
[img]http://demo.dtn.com.vn/download/processimage.jpg[/img]

There're 4 steps in the process and I want users to be able to assign different user in each step. I deployed the definition successfully but only in the first step, I can select user to assign to, the subsequent steps, there's no select box to choose user.

Process definition:

<?xml version="1.0" encoding="UTF-8"?>
<process-definition
  xmlns="urn:jbpm.org:jpdl-3.1"  name="wf:testProcess">
 
   <swimlane name="initiator"></swimlane>
   <swimlane name="secretary">
      <assignment actor-id="#{bpm_assignee.properties['cm:userName']}" />
   </swimlane>
   <swimlane name="manager">
      <assignment actor-id="#{bpm_assignee.properties['cm:userName']}" />  
   </swimlane>
   <swimlane name="chief">
      <assignment actor-id="#{bpm_assignee.properties['cm:userName']}" />  
   </swimlane>
   <swimlane name="officer">
      <assignment actor-id="#{bpm_assignee.properties['cm:userName']}" /> 
   </swimlane>
  
   <start-state name="start">
      <task name="wf:enterDocTask" swimlane="initiator"></task>
      <transition name="" to="preProcessDoc"></transition>
   </start-state>
   <task-node name="preProcessDoc">
      <task name="wf:preProcessDocTask" swimlane="secretary"></task>
      <transition name="processDocTrans" to="processDoc"></transition>
   </task-node>
   <task-node name="processDoc">
      <task name="wf:processDocTask" swimlane="manager"></task>
      <transition name="reviewTrans" to="check"></transition>
   </task-node>
   <task-node name="check">
      <task name="wf:checkTask" swimlane="chief"></task>
      <transition name="publishTrans" to="publish"></transition>
   </task-node>
   <task-node name="publish">
      <task name="wf:publishTask" swimlane="officer"></task>
      <transition name="" to="end"></transition>
   </task-node>
   <end-state name="end"></end-state>  
</process-definition>

Task model:

   <type name="wf:enterDocTask">
         <parent>bpm:startTask</parent>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>

      <type name="wf:preProcessDocTask">
         <parent>bpm:workflowTask</parent>
         <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides>
       <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>
     
      <type name="wf:processDocTask">
         <parent>bpm:workflowTask</parent>
         <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides>
       <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>
     
      <type name="wf:reviewTask">
         <parent>bpm:workflowTask</parent>
         <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides>
      </type>

      <type name="wf:checkTask">
         <parent>bpm:workflowTask</parent>
         <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides>
      </type>  
7 REPLIES 7

davidc
Star Contributor
Star Contributor
Hi,

You need to configure the UI dialog for each of your new tasks to allow the user to select the next workflow participant.

e.g.

in web-client-config-properties.xml, add the following for your "Pre Process" task…

<config evaluator="node-type" condition="wfSmiley TonguereProcessDocTask" replace="true">
   <property-sheet>
      <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
      <show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
      <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
      <show-association name="bpm:assignee" />
   </property-sheet>
</config>

and repeat for your other tasks.  Each task dialog can display/edit its own set of properties.

Just one comment on your definition.  I see you're re-using bpm_assignee in each of the tasks.  That's ok with your serial process, however, the bpm_assignee will be overwritten in each step.  If you want to maintain all the assignees during the workflow, and refer to them later on, you can use a different association name for each.

tiennd
Champ in-the-making
Champ in-the-making
Thank you, David. It's working now.
Thank you for the comment, I will need to define aspects for each step.

davidc
Star Contributor
Star Contributor
Btw, you don't have to define an aspect.  You can just add an association directly to your task definitions.

zouhair
Champ in-the-making
Champ in-the-making
Can you explain (with an example if it's possible) how to define a different association name for each assignee in the workflow.
Thank you very much for the response.
Hope it will be quick!
Ciao!

davidc
Star Contributor
Star Contributor
You can define a model something like…


<model …

   <type name="wf:submitTask">
        …
        <associations>

            <association name="wf:reviewer">
               <title>Reviewer</title>
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:person</class>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </target>
            </association>

            <association name="wf:manager">
               <title>Manager</title>
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:person</class>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </target>
            </association>

         </associations>
       
   </type>

</model>

sofie24
Champ in-the-making
Champ in-the-making
Hi,

I've tried everything in this post.
The first reviewer can add other reviewers to the workflow, but the workflow is never send to those reviewers.

Any idea what went wrong?

Sofie

sofie24
Champ in-the-making
Champ in-the-making
I'm sorry I forgot the code:

workflowModel.xml
<type name="wf:checkBillTask"> 
         <parent>bpm:startTask</parent>
        <!– <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides> –>
       <mandatory-aspects>
            <aspect>bpm:assignees</aspect>
         </mandatory-aspects>
      </type>

web-client-config-properties.xml
<config evaluator="node-type" condition="wf:checkBillTask" replace="true"> 
     <property-sheet>
       <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
       <show-property name="bpm:taskId" />
       <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
       <show-property name="bpm:dueDate" read-only="true"/>
       <show-property name="bpm:priority" read-only="true" />
       <show-property name="bpm:status" />
       <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
       <show-association name="bpm:assignees" />
     </property-sheet>
   </config>