For certain actions where a user wants to proceed in the workflow with a UserTask, I have the taskId and use taskService#complete in order to complete it.
At that point I want to get the processInstance because I have to make some modifications on a business object which has the process instance id stored.
How would I be able to get the processInstanceId when I have the taskId? I understand that a Task is also an Activity and have seen in another question that I could somehow use a processInstanceQuery with the activityId (I guess the taskId is also an activityId). And if yes, how can I use a processInstanceQuery to get the processInstanceId.