Can't get document by url or id

Hey guys,
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.

First try:
I got the url of my pdf, its: documentDownload?fileName=BookOne.pdf&contentStorageId=1643
https://ibb.co/fPvwXJ

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
https://ibb.co/kfakRd

Second try
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.

:confused: help, pls

1 Like

Hi,

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?

Thanks.

Hi,
yes and no. It was uploaded in a previous process, not step. This are my steps:

  1. Start process and upload one pdf-file
  2. Download PDF from previous step of my process and end the process.
  3. Now I’m on my homepage, where I can see all my reports in a table. Im getting my reports via query through my bdm. So here on my homepage I want to download this file. But I guess I need a context, but on my homepage-form I dont have a context.

I will upload tomorrow my project, thanks a lot!