Create Document List with java API

Hi all,

I have a process instance A with no Document List defined in it. I would like that another process B create a Document List in process instance A.

I tried setDocumentList(long processInstanceId, String name, List<DocumentValue> documentsValues) but I get an error "org.bonitasoft.engine.bpm.document.DocumentException, Unable to set the list annexes on process instance ....

Caused by: org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException: Unable to find the list annexes on process instance ..., nothing in database and nothing declared in the definition."

What should I do before calling setDocumentList(), to modify the process definition of A or create a Document List in it ?

Thank you,

Philippe