cancel
Showing results for 
Search instead for 
Did you mean: 

Immediate help needed

agrawalanish
Champ in-the-making
Champ in-the-making
I have a question.

I need to design a screen through which can browse a bpmn 2.0 file and deploy the process. This is perfectly fine and am able to do the same.

before starting the process, how to retrieve all the activities (user task, sub process, email task) for this process and allow admin of our application to assign custom role for each one. during execution use this custom role and allow users having this role from my database to claim and complete the task. how to achieve this.

Also want to understand how to achieve below -

a maker
multiple reviewers
multiple approvers

multiple approvals are required. trying with multi instance user task but if any approver rejects the task should be delegated to the maker and flow should resume in above mentioned sequence.

Please suggest a sample example.

After deploying the process and without starting the process, need to display all activities (i.e. user task/sub process/email task) in my screen and allow the admin of our application to assign a custom role to each. How to achieve this?

i.e. at during execution of task/activity, it will be claimed and completed by the user having the custom role.
10 REPLIES 10

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi agrawalanish.

before starting the process, how to retrieve all the activities (user task, sub process, email task) for this process and allow admin of our application to assign custom role for each one. during execution use this custom role and allow users having this role from my database to claim and complete the task. how to achieve this.
You can start process with variables and use variables in candidateGroups for tasks.
To get list of tasks for the process you can get them from BPMNModel (as an example you can use ProcessDiagramGenerator).

Also want to understand how to achieve below -

a maker
What is it a maker?

multiple reviewers
multiple approvers

You could do that with several different ways.
One of them could be to use MultiInstance tasks.

Regards
Martin

Thanks a lot Martin.

I am a beginner in Activiti.

To get list of tasks for the process you can get them from BPMNModel (as an example you can use ProcessDiagramGenerator).
Anish: Is it possible to provide a sample example for this?

What is maker?
Anish: Maker is the user (with specific role) who can create a record for review and approval by other users.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

Anish: Is it possible to provide a sample example for this?

Based on ProcessDefinitionId (you can get it from the process instance), you can get process definition. Process definition contains list of activities.

<code>
     ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ( ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition( processDefinitionId ));
           
        for (ActivityImpl activity : processDefinition.getActivities()) {
        …..
        }
</code>

Thanks a lot Martin.

Is it possible to assign a custom role for each activity while displaying the list of activities to our admin?

Say I have a multi instance activity to which I want to assign a custom role and multiinstances should be created for each user having this role. Please let me know how to achieve the same.

martin_grofcik
Confirmed Champ
Confirmed Champ
Say I have a multi instance activity to which I want to assign a custom role and multiinstances should be created for each user having this role. Please let me know how to achieve the same.

  • create list of users with specified role
  • put this list to the MultiInstanceLoop
  • user task in the multiinstance instance loop can address loopCounter (or loopIndexVariable) and fetch item from the list - do it in the expression and use this expression as assignee.
(I personally do not like assigning tasks directly to the users. (Vacations,….) )

Regards
Martin

chetan1
Champ in-the-making
Champ in-the-making
could you please tell me the entire process to deploy code

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi.
you can find example in the activiti tests

  @Deployment
  public void testParallelUserTasksBasedOnCollection() {
    List<String> assigneeList = Arrays.asList("kermit", "gonzo", "mispiggy", "fozzie", "bubba");
    String procId = runtimeService.startProcessInstanceByKey("miParallelUserTasksBasedOnCollection",
          CollectionUtil.singletonMap("assigneeList", assigneeList)).getId();
   
    List<Task> tasks = taskService.createTaskQuery().orderByTaskAssignee().asc().list();
    assertEquals(5, tasks.size());
    assertEquals("bubba", tasks.get(0).getAssignee());
    assertEquals("fozzie", tasks.get(1).getAssignee());
    assertEquals("gonzo", tasks.get(2).getAssignee());
    assertEquals("kermit", tasks.get(3).getAssignee());
    assertEquals("mispiggy", tasks.get(4).getAssignee());
   
    // Completing 3 tasks will trigger completioncondition
    taskService.complete(tasks.get(0).getId());
    taskService.complete(tasks.get(1).getId());
    taskService.complete(tasks.get(2).getId());
    assertEquals(0, taskService.createTaskQuery().count());
    assertProcessEnded(procId);
  }
Process definition
https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/test/resources/org/acti...

Regards
Martin

chetan1
Champ in-the-making
Champ in-the-making
how to configure h2 databse with activiti

cshar
Champ in-the-making
Champ in-the-making
how can we add custom roles and give them permissions (read/ write)? Also will that be available in a activiti diagram while defining tasks?