Document not found exception in subprocess

I have a main process and a subprocess. I have a document field in the main process where the user uploads his document. Mapping is done between the two processes .So the processflow is, file gets uploaded in mainprocess and then goes to the subprocess where it can be used .Important point to be noted- The document field is not mandatory.
The issue which i am facing is this. When the subprocess is reached, i get an error saying “document not found”.
In some cases the user may not upload any document. When this happens, this is the error i get.

Groovy script throws an exception of type class org.bonitasoft.engine.bpm.document.DocumentNotFoundException with message = org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException: Document not found:

How can i resolve this?
It seems weird because the way this works is that it forces the end user to always upload a file. Is this way the mapping of documents work in Bonita version 7.1?

Any help would be appreciated.
Regards,
Sanjeev

Hi,

There is actually an example on Git Hub: https://github.com/Bonitasoft-Community/parent-child-shared-document

Cheers

Any way you can isolate the Groovy script that throws this error? How do you map the document from the parent process to the sub-process? Using the contract?

Hi Lionel,

If i isolate the script , then there will be no way for me to pass the document from the parent process to the subprocess.The only way wont give me an error is to remove the document field itself. I have followed the documentation in ‘documents and called process’. I have used a main and sub doc and mapped it the usual way in the call activity. I haven’t used a contract.

Regards
Sanjeev

Lionel,
If i use a contract as mentioned in the example, wont it still fail because the contract input will always be mandatory.? In my case, the field is optional. So sometimes the user would not upload any document.