retrieving generated document raw data

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

retrieving generated document raw data

After generating a document with a Generate Document task, and I need to retrieve the raw document afterwards.  I know I can do this with the endpoint: /enterprise/content/{contentId}/raw endpoint, so I have a Script task following the generate document task that calls this endpoint.  I keep getting a 404 not found error when the process is run, but the document is successfully retrieved when that same url is called after the process that generated the document is done.  I tried generating the document in a subprocess (see the attached pictures) to see if the document would be available once the subprocess is done, but I got the same results.  I also tried splitting up the processes into two separate processes, one to generate the document and the other to retrieve the data.  Then I called the second process from an execution listener that gets triggered when the first process (the document generation) is completed, but I'm still getting the same results. 

This leads me to ask the following question: are generated documents not able to be retrieved through the api until the entire process that the document was generated in has been completed?

2 Replies
Highlighted
Alfresco Employee

Re: retrieving generated document raw data

It's probably an issue it timing. The generated document task runs asynchronously. So it might have not fully stored the document at the time you called it. Try adding a timer before the script task that will pause for few seconds.

Highlighted
Member II

Re: retrieving generated document raw data

Apparently I just needed to check the "Async" checkbox in the script task, then the document generated asynchronously in the generate document task was available to be retrieved.