How to take active user task base on latest process instance key

Hello,
i tried to fetch latest active user task based on latest process instance key
but it is coming old process instance key data.
can you suggest me what i have to do in this case.
Thanks in advance.

Regards,
Supriya K.

Hello @Supriya
Could you please describe the business case that you want to solve in more detail? It will help to understand the end goal and give a better answer.

Regards,
Alex

Thanks for the details but it feels I still miss something.
I see that you have System.out.println and you say that “it is showing old process instance”. Could you share the full output of your System.out.println logs and explain what part of the output is “old” in your opinion.


this is my latest process instance key.

and in this line System.out.println i am getting
JobKey: 2251799814303898, ProcessInstanceKey: 2251799814303871

JobKey: 2251799814308173, ProcessInstanceKey: 2251799814308143

JobKey: 2251799814308174, ProcessInstanceKey: 2251799814308143

JobKey: 2251799814308175, ProcessInstanceKey: 2251799814308143

JobKey: 2251799814308176, ProcessInstanceKey: 2251799814308143

JobKey: 2251799814312266, ProcessInstanceKey: 2251799814312207

JobKey: 2251799814312267, ProcessInstanceKey: 2251799814312207

JobKey: 2251799814312268, ProcessInstanceKey: 2251799814312207

JobKey: 2251799814312269, ProcessInstanceKey: 2251799814312207

JobKey: 2251799814313055, ProcessInstanceKey: 2251799814313028