TerranceK4053 Member since 2018 45 posts
Posted: 1 year ago
Last activity: 1 year 5 months ago

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);
}catch(Exception e)
oLog.error("Error in generating the document" + e.getMessage() + url);
String filePath = "file://web:/StaticContent/global/ServiceExport/" + pega_rules_string.whatComesAfterLast(url, '/');
// filePath = url;
// filePath = "BCBSMSFax1__1553292163416.docx​"; fileInputStream=null; file = new;
byte[] bFile = new byte[(int) file.length()];
try {
fileInputStream = new;;
catch(Exception e){
/* Change the name of the Test.docx to the actual file name that needs to be downloaded with extension.*/
String sErrorMessage = tools.sendFile(bFile, "Test.docx", false, null, true);
if (sErrorMessage != null){
tools.getThread().getThreadPage().putString("pyXMLStream", sErrorMessage);
//pega_rules_default.downloadFile(url, tools, false);

***Edited by Moderator Marissa to update platform capability tags; add SR Details****

System Administration SR Exists
Moderation Team has archived post
Share this page LinkedIn