cancel
Showing results for 
Search instead for 
Did you mean: 

Get process instances that user can participate, how?

sergiofigueras_
Champ in-the-making
Champ in-the-making
Hi everyone,

I'm looking for a way to get the user processes that is involved. For example:

UserA starts a process instance about Loan.
The subsequent task is designed to be executed by GroupB.
UserB, from GroupB, claims the task for himself, but, when he clicks in Process Details, to see the process flow and log, he doesn't have any access to that process instance, so, he cannot see the process details, because he didn't started the process.

In MyProcessInstancesListQuery, we've:

public Item loadSingleResult(String id) {
    HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
      .startedBy(ExplorerApp.get().getLoggedInUser().getId())
      .unfinished()
      .processInstanceId(id).singleResult();
    if (processInstance != null) {
      return createItem(processInstance);
    }
    return null;
  }

But I want a query that gives to the user the graphic image of  the process that he's involved, not just the started processes.

How can I achieve that?

Regards!
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
Since 5.12, there is a new concept introduced related to "users involved" with a process and you can query processes which have a certain user involved. When a user is assigned a task, he/she is automatically involved in the process (also the process initiator) but you can involve more people in the process.

To see what (running) processes a user is involved in, you can use ProcessInstanceQuery:

/**
   * Select the process instances with which the user with the given id is involved.
   */
  ProcessInstanceQuery involvedUser(String userId);

gromar
Champ in-the-making
Champ in-the-making
But I want a query that gives to the user the graphic image of the process that he's involved, not just the started processes.

Do you mean something like that:
[img]https://raw.github.com/gro-mar/activiti-crystalball/master/image-builder/src/test/resources/org/acti...[/img]

if yes there is description on activiti-crystalball page, and example: Drawing-into-process-diagram