Can't get document by url or id
I read this: https://documentation.bonitasoft.com/6.x-7.2/documents-0 and tried to implement this but faild.
I tried two ways, that I will show you and maybe some of you can help me and say what the next steps could be.
I got the url of my pdf, its: documentDownload?fileName=BookOne.pdf&contentStorageId=1643
So on my Homepage I have a table with all requests and I thought by using the url in a link I could get the Pdf, but the url doesnt work. The variable is called dokument_id because I was to lazy to rename it, so Im saving the url in dokument_id This is how I tried on the homepage to get the pdf
I got the id, it is 1643. And the documentation says that I have to use this code
import org.bonitasoft.engine.bpm.document.Document; import org.bonitasoft.engine.bpm.document.DocumentValue; Document doc=apiAccessor.getProcessAPI().getDocument(sub_docId); DocumentValue docValue=new DocumentValue(apiAccessor.getProcessAPI().getDocumentContent(doc.getContentStorageId()), doc.getContentMimeType(), doc.getContentFileName()); return docValue;
Im working with the UI Designer and Im new to bonita, so I dont know how to use this in the designer. Even if I paste this in a java script variable and dont know how to access this pdf to download it.
I guess the second way is the right way, but I dont know how to implement that.
:/ help, pls
If my understanding is correct you want to allow the user to download a document that was uploaded in a previous step of your process. Is that correct?
In order to help you, can you export your process with forms from the Studio using the export button and share the file using for example Google Drive or Dropbox?