Posted: 26 Mar 2019 9:24 EDT Last activity: 9 Apr 2019 10:19 EDT
Unable to download file from Service Export directory
I generated a word document using pzGenerateDocument. The url that is returned seems to imply the file has been generated in the service export folder. I need to download this file to my desktop. How do I accomplish this? I tried using downloadFile function but it can't find the file. I also tried using straight java code to access the file but it cannot find the file either. I am told by pega cloud support that the file is there and has data in it as we are operating in the pega cloud. I've tried specifying the path a number of different ways neither of which I am able to find the file.
url=com.pegarules.generated.pega_appdefinition_documentapp.pzGenerateDocument("BCBSMSFax1", tools, "NS-FW-MR-Work-RequestRecords", null);
oLog.error("Error in generating the document" + e.getMessage() + url);
Wow. I just got a message from Cloud Support that for Pega cloud environments you cannot download files from service export. So that's why downloadFile does not work. So now what? Attach it to the work object first?
Check the Pega cloud file storage service: https://community.pega.com/knowledgebase/articles/pega-cloud-services-file-storage. In cloud environments, all ec2 instances are ephemeral, files can come and go on an instance, that is why the service quoted here, internally files are stored in the specific AWS S3 bucket, you can retrieve them through sftp client at any time. Also writing custom java code is highly discouraged.
SO what you are saying is that in a Pega cloud environment a user of an application cannot generated word documents nor PDFs through a Pega application and save it to there desktop? We have to instead give users ability to use SFTP to transfer the files to their desktop? Or you mean instead of using downloadFile or SendFile I could use this repository api to retrieve the file after the document has been generated on the serve? Hopefully that will allow the user to at least be prompted from the application to be able to save the file to their desktop?
My comment is mainly regarding custom java code that you are writing, which is highly discouraged whether it is pegacloud or on-prem. This is against the guardrail. Is there any reason for that? I want to make sure that you have exhausted all other options. Every time you find yourself writing java code, you should always question why. Pega writes code so that you do not have to. Pega has a lot of built-in features that allow downloading documents directly to desktop (e.g., application documents in DCO).