Hi,
In my process, I retrieve some documents provided by the user (List of documents) and I can generate 0 or several .docx files (Single Document).
At some point, I have to send an email with the provided and generated files. To do so, I created a script in the attach file part of the email connector :
import org.bonitasoft.engine.bpm.document.Document ArrayList<Document> docs = list_of_documents_given_by_user; if( docGenerated0 != null && docGenerated0.contentFileName != null ) docs += docGenerated0; if( docGenerated1 != null && docGenerated1.contentFileName != null ) docs += docGenerated1; // ... return docs;
Unfortunately, The email contains only the docGeneratedX files and not the list_of_documents_given_by_user, although in the log I get the mention of all the correct attachments ( for example, 2 files in the list_of_documents_given_by_user and 1 file docGenerated0 ).
DocumentImpl{id=2935, processInstanceId=18009, name='list_of_documents_given_by_user', author=101, creationDate=Tue Mar 02 14:19:27 HST 2021, hasContent=true, fileName='04_montageProjetCablage.txt', contentMimeType='text/plain', contentStorageId='3335', url='documentDownload?fileName=04_montageProjetCablage.txt&contentStorageId=3335', description='ajout', version='1', index=0} DocumentImpl{id=2936, processInstanceId=18009, name='list_of_documents_given_by_user', author=101, creationDate=Tue Mar 02 14:19:31 HST 2021, hasContent=true, fileName='04_montageProjetGC.txt', contentMimeType='text/plain', contentStorageId='3336', url='documentDownload?fileName=04_montageProjetGC.txt&contentStorageId=3336', description='ajout', version='1', index=1} DocumentImpl{id=2937, processInstanceId=18009, name='docGenerated0', author=-1, creationDate=Tue Mar 02 14:20:41 HST 2021, hasContent=true, fileName='demandeAutorisationDEQCablage.docx', contentMimeType='application/octet-stream', contentStorageId='3337', url='documentDownload?fileName=demandeAutorisationDEQCablage.docx&contentStorageId=3337', description='null', version='1', index=-1}
I also tried to loop through the files in list_of_documents_given_by_user in order to add them to the list docs which is returned, but the result is the same.
Any ideas?
Best,