Resume Process Instances

I am developing my application over flowable, sometimes it happens my process didn’t get complete at one go and user have to wait for a while and come again to continue the process,
while history of that incomplete process is saved in ACT_RU_VARIABLE,

whenever user comes again and want to continue the process from the point where he left, how can I continue (to say restart ) or assign the same process Instance to the user.

Hello,

You can query for active processes for the given user, and continue from there.

I tried but couldn’t find the right query. Can you help???

I tried
runtimeService.activateProcessInstanceById(processInstanceId);

it is giving me error
“Cannot set suspension state ‘active’ for ProcessInstance[processInstanceId]’: already in state ‘active’.”,

this is incomplete process and I want to complete this instance

You should query for something like

List<ProcessInstance> instanceList = runtimeService
  .createProcessInstanceQuery()
  .involvedUser("userId")
  .list();

Where “userId” is the id of the involved user. With that you’d have the active ProcessInstances. See https://flowable.org/docs/userguide/index.html#queryAPI for additional information.

1 Like

this is creating new processInstance involving that user instead of getting the older one

No, the code I put is creating a query to search for processes for the given userId, not creating new process instances. You can filter more and ask for process that are not completed, and so on.

Normally processes stop on a wait_state, usually on a user task that the user would have to complete. You could query for tasks of the user, please refer to User guide getting started