cancel
Showing results for 
Search instead for 
Did you mean: 

Task assignment to a particular user

neelam
Champ in-the-making
Champ in-the-making
Hi

I have created one workflow in which I am initiating the workflow from admin account but i want to assign the next task to a particular user let say  'abc'.can i do this by adding the following lines in the process definition or do i have to add pooled task tag for assigning the task to the specific user.

<swimlane name="assignee">
  <assignment actor-id="#{bpm_assignee.properties['cm:abc']}"/>
</swimlane>



Thanks
8 REPLIES 8

cheffilet
Champ in-the-making
Champ in-the-making
Simple approach could be following:

<task-node name="review">
        <task name="wf:reviewTask">
            <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
               <actor>#{bpm_assignee}</actor>
            </assignment>
        </task>

       …
</task-node>

To resolve the variable bpm_assignee, at least you have to set a processvariable on workflow-start (or later by an action or something else that has access to the ExecutionContext of JBPM).

Something like this should work:


Map<QName, Serializable> params = …
params.put(WorkflowModel.ASSOC_ASSIGNEE, "thomas");
getWorkflowService().startWorkflow(selectedWorkflow, params);

jayjayecl
Confirmed Champ
Confirmed Champ
Easiest way, if you want the user whose userName is "abc" to be the swimlane :


<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
  <actor>abc</actor>
</assignment>

major_king
Champ in-the-making
Champ in-the-making
Hello together,

and what's the way to assign three specific groups to three different swimlanes via java api? Is this possible?

Thanks for helping
Christian

jayjayecl
Confirmed Champ
Confirmed Champ
If you have those swimlanes in your processDefinition.xml :


<swimlane name="Group_1">
          <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <pooledactors>#{var_Group_1}</pooledactors>
      </assignment>
    </swimlane>

<swimlane name="Group_1">
          <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <pooledactors>#{var_Group_3}</pooledactors>
      </assignment>
    </swimlane>

<swimlane name="Group_3">
          <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <pooledactors>#{var_Group_3}</pooledactors>
      </assignment>
    </swimlane>

The following java snippet will set those swimlanes with the suitable groups (for example "GROUP_VALIDATORS", "GROUP_ADMINS", and "GROUP_USERS"):


executionContext.setVariable("var_Group_1", "GROUP_VALIDATORS");
executionContext.setVariable("var_Group_2", "GROUP_ADMINS");
executionContext.setVariable("var_Group_3", "GROUP_USERS");

major_king
Champ in-the-making
Champ in-the-making
Thanks for helping Smiley Happy

Swimlanes are defined in processdefinition.xml.

I only have one small question: how will i set/get/define the execution context and where?

jayjayecl
Confirmed Champ
Confirmed Champ
You have 2 solutions :
- call a Java class somewhere in your processDefinition… of course, the Java class setting the swimlane X has to be fired before you enter a task having the swimlane X assigned
- put the snippet into an Alfresco script in your processDefinition… same remark

see Jeff Pott's excellent article
http://ecmarchitect.com/archives/2007/11/19/785
It will illustrate both cases

7joeblack8
Champ in-the-making
Champ in-the-making
sorry if i bump this thread…but it is possible to do the same thing in Activiti?

deba
Champ in-the-making
Champ in-the-making
Hi if I understand correctly your requirement then you are trying to call a child workflow from parent workflow right?? For this you can call a java class from your service task. And from this java class you can initiated another workflow. Like this

processEngine.startProcessInstanceByKey("ChildWorkflowProcessId");

and in child workflow you can add n number of assignee groups as per your requirement.