Is there a way to wait for process instance end?

#1

I’ve read about isEnded() method of ProcessInstance and I need to wait for it to end to perform some operations. I need to do this because I’ve noticed that sometimes I try to get process instance variables but the process instance seems it has not finished yet, so I want to get these variables when I’m sure the process is finished.
Is it possible?

#2

This very much depends on the process you are trying to model.

Sometimes the process instances goes into wait state because it needs a user input (has a user task). This process would end only after the user task has been completed.

Having said this, you can get process variables from a running process instance as well.

Perhaps you could share the process definition and explain more into detail what you are trying to do, so we can be of more help.

Cheers,
Filip