Listing tasks of process with call activity subprocesses

Hello, what is the preferred way of listing tasks of a process and all it’s subprocesses model via “call activity”. We need to to be able to list next tasks after some completeTask operation was executed. In generic solution, the next task can be in the same process or it’s subprocesses.

Of course we could select all subprocesses of a process and then select task by selected processinstanceid, but that would result in many selects, which we would like to avoid.

Another solution could be by using business key, however, for our use case, we would need to know the business key of the “completed” task parent process id, because business key is not part of Task db entity nor the DTO that is return by the rest endpoint. Is there any reason, why there is no column in the db and no property in the DTO for parent process business key as it is e.g. for case instance id?

Another possible solution would be by starting the process with case instance id set, which is then automaticaly passed to the subprocess. However, with case instance id, we suspect, that it’s original purpose was to be used when the process is triggered from CMMN. Wouldn’t using case instance id somehow “hacking” it’s original purpose? Could we get in trouble in future, if we started to use CMMN? Or is this the solution of our problem, since there is no foreign key on the caseInstanceId field and therefore it seems to be the right solution?

Are there any other possible solutions to our use case?