How to fetch A document from a Subprocess and show it in the Main Parent Process

Hi
I have a Parent process and Several Subprocesses.
Based on condition evaluated, I call different Subprocesses.
Now I am using the Auto generated Overview page.
There i can see all the Documents that are associated with the Parent Process.
But I cant see any of the Documents associated with the Subprocess.

Is there a a way to Display the Documents from the Subprocess in the Overview Page.
what are the different ways we can show Documents from Subprocesses in parent Process.
Is there a way to fetch Documents from Subprocesses using parent Case id.

My scenario is Similar to the below Question.
https://community.bonitasoft.com/questions-and-answers/documents-subprocess-arent-shown-overview

any suggestions will be helpful as I am lost here.

Hello,
You’ll need to pass in the document id to the child process. Using a script you’ll do something like:

return yourDocument.getId();

You can then retrieve the document at any time using the reference.

I read it the other way around but the same principle applies. You’ll need to pass back the reference to the document from the child to the parent. I usually just map it to a process variable. You can then use that process variable in a form to view the document. Say for example to create a process variable called docId in the parent process. You would send the document id from the child to the parent in the “Data to receive” section in the called process activity. You can then retrieve it in the form using and an external API:

childDocId (variable in form)
../API/bpm/caseVariable/{{task.parentCaseId}}/docId

and then retrieve the document using a Javascript expression:

docUrl (variable in form)
var webappName = window.location.href.split('/', 4)[3] || 'bonita'; return '/'+ webappName +'/portal/formsDocumentImage?document='+ $data.childDocId.value;

And then use the File Viewer widget using URL as file source and docURL from above as the URL.

thanks for your answer.
Could you elaborate a little bit.
just to iterate, I am trying to fetch documents from child to parent.
Do I create two document variables, one in parent and One in child.
Then Map child document with parent ?
Any ways to use the child document only but pass the reference to the parent process.

thanks.

Thanks.
I do understand you answer now. Thanks for Explaining . I appreciate the help.
I guess that would work in case I have only one or two Documents.
But unfortunately My sub processes are very Big with lots of documents .
I have around 10-13 Sub processes , So I cant create so many Process Variables.

I am looking for alternate solutions.
Like using case id to fetch all case Documents related to the Case.

Thanks & Regards