cancel
Showing results for 
Search instead for 
Did you mean: 

workflow-swimlane

baby77
Champ in-the-making
Champ in-the-making
Hello everybody,

i need urgent to find out how to define diffrent user to finished the workflow process than initiator.
I use fork and join options.
Example i start a workflow and define 2 users to approve or recejted it,but when this is done the person who start the workflow finished it.And i dont wont that,i need to do that reviewer finished it.

Please need advise/help how to do it.
TNx Smiley Very Happy
5 REPLIES 5

baby77
Champ in-the-making
Champ in-the-making
Nobady knows how to use swimlane to finished task some else not the initiator.
I know u can define more swimlanes but i dont know how to set that reviewer1 is one who complete task done.
<swimlane name="initiator"/>
<swimlane name="reviewer">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<actor>#{bpm_assignees}</actor>
</assignment>
</swimlane>
<swimlane name="reviewer1">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<actor>#{person.getPerson("abcdef)"}</actor>
</assignment>
</swimlane>

Maybe i am thinking wrong but i dont see any solution yet, i am trying some time.  Smiley Surprisedops:
I need some example, anything,please.
Thanks a lot.

mrogers
Star Contributor
Star Contributor
In your task definition you specify which swimlane it applies to.

Here's an example extracted from 'review_processdefinition.xml'.

    <swimlane name="reviewer">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <actor>#{bpm_assignee}</actor>
        </assignment>   
    </swimlane>

    <task-node name="review">
        <task name="wf:reviewTask" swimlane="reviewer">
            <event type="task-create">
                <script>
                    if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                    if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
                </script>
            </event>
        </task>
        <transition name="approve" to="approved" />
        <transition name="reject" to="rejected" />
    </task-node>

And here's the corresponding definition of wf:reviewTask froom wcmWorkflowModel.xml showing the reviewTask task has
a bpm:assignees aspect.

    <type name="wcmwf:reviewTask">
      <parent>wcmwf:workflowTask</parent>
      <overrides>
        <property name="bpmSmiley TongueackageItemActionGroup">
          <default>edit_wcm_package_item_actions</default>
        </property>
      </overrides>
      <mandatory-aspects>
        <!– One or more reviewers - this is here to allow view of all reviewers –>
        <!– in the review task –>
        <aspect>bpm:assignees</aspect>
        <aspect>wcmwf:submission</aspect>
        <aspect>wcmwf:reviewType</aspect>
      </mandatory-aspects>
    </type>

baby77
Champ in-the-making
Champ in-the-making
This task is last before process is completed if i understand it right.
<task-node name="approved">
      <task name="sw:approvedTask" swimlane="initiator" />  —>here i change to reviewer1,doesn't work
      <transition to="end" />
</task-node>
<end-state name="end"/>
And now my problem,when reviever approved task owner gets button task done-i don't won't that.i need reviewer gets button task done.
How to add to the original user who start the workflow another user to get the button task done?This person is one of those who before approved task?
Is this possible to do it? I don't know is my logic wrong.Have i missed something in theory?
I am going crazy trying to solve this.

Any ideas,anything?
Tnx Smiley Happy

baby77
Champ in-the-making
Champ in-the-making
Hello,
i am still stuck with the same problem.
Does anyone know if it is possible to overwrite the start initiator with diffrent user or somehow to add another user to see and complete the last task?Maybe with script?
Is there any example available?

robinflow
Champ in-the-making
Champ in-the-making
There are several ways to do this, I'm not sure which one is the right for you:

1) Make a swimlane and assign the last task-node to this swimlane, i.e.:

    <swimlane name="otherperson">
        <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <actor>#{bpm_assignee}</actor>
        </assignment>   
    </swimlane>

This swimlane's assignee is the person you chose at the first step.
The end task will be then:

   <task-node name="approved">
      <task name="wf:completed" swimlane="otherperson" />
      <transition name="Done" to="end" />
   </task-node>   

This is the last step, since the transition to="end" ends the workflow (meaning there is no step after this).

2) You change the initiator in the workflow's processDefinition.xml

just add:
initiator = people.getPerson(assignee).properties.userName;
(or: bpm_initiator = people.getPerson(assignee).properties.userName; )
or if you know the username, try:
initiator = "username";
or:
bpm_initiator = "username";

3) This is the most likely to work! You can add your own java class and use it as an action in the processdefinition.
In the processdefinition (inside the transition) put:
<transition to="approved">
<action class="com.mydomain.MyClass" />
</transition>

Now in the actual class you need to put quite a lot of code, but hopefully my comments will clear up the mess for you:

package com.mydomain;

import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.graph.exe.ExecutionContext;
import org.springframework.beans.factory.BeanFactory;

public class MyClass extends JBPMSpringActionHandler {

   private ServiceRegistry services;

   @Override
   protected void initialiseHandler(BeanFactory factory) {
      services = (ServiceRegistry) factory
            .getBean(ServiceRegistry.SERVICE_REGISTRY);
   }

   public void execute(ExecutionContext executionContext) throws Exception {
      ContextInstance ci = executionContext.getContextInstance();

      // You can set the already existing assignee to become the initiator as below:
      NodeService nodeService = services.getNodeService();
      NodeRef newUser = ((JBPMNode) ci.getVariable("bpm_assignee")).getNodeRef();
        ci.setVariable("initiator", new JBPMNode(newUser, serviceRegistry));
   }
}

I hope that helps! Let me know!
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.