Question
Capgemini
SE
Last activity: 19 Jan 2021 8:12 EST
Download working only once
I want to download a simple text document on click of a button in PRPC7.3.1. On click of the button I refreshed the section and called an activity that has just one java step. The java content is given below. On first click of the button, the document is downloading properly but thereafter its not throwing to browser. I traced, all the steps are executing properly. If I refresh the complete URL from browser, it again works fine for one time only.
ClipboardPage objHeadersPage = tools.findPage("pxRequestor").getProperty(".pyHTTPResponseHeaders").getPageValue();
objHeadersPage.putString("contentType" ,"text/plain");
objHeadersPage.putString("ContentDisposition" ,"attachment;filename=test.txt");
String contents="Hello World!!";
byte[] bContents=contents.getBytes();
String result=tools.sendFile(bContents,"test1.bat", false, null, true);
-
Like (0)
John Croft -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems Inc.
US
Seems similar to the issue in the below Support Article. It may need to be modified depending on your scenario but worth checking.
https://pdn.pega.com/support-articles/export-excel-downloads-file-only-once
Capgemini
SE
Thank Carissa.. The javascript function worked like a charm.
Tata Consultancy Services
IN
Hi Abikash,
What do we need to pass as applicationName? and the activity (which i guess is our custom activity), does it also contain the exporttoexcel step also?
Capgemini
SE
Hi Avishek - You can get Application Name from your access group. The activity should contain a step that throws the excel's content byte array to browser e.g tools.sendFile(byteArray,FileName, false, null, true);
Tata Consultancy Services
IN
Thanks Abikash. So, will it work if I directly call ExportToExcel in the custom activity? Because if the activity is run stand alone it generates the excel and downloads it.
BACS
IN
I am not able to open this link. It shows nothing.
Pegasystems Inc.
IN
Hello @MaruthiV
Thank you for spotting this broken link. Here is the valid link to the same support article:
I hope this article is the one you're looking out for.
Thank you!
J.P. Morgan Services India PVT Ltd
IN
could see some helpful discussions/solutions:
Capgemini
SE
Thanks Neha. The suggested solution worked great!!
Secure Digital Assets LLC
US
Easiest solution for me was to trigger the button to "open url in window" then call an activity with your code attached. Window pops up for a split second and download triggers every time.
DXC Luxoft
LK
i also able to make it work by call activity in refresh harness : on event of click with disable on submit.
-
Damien Gan Devendra Pawar Bayron Jaziel Alvarez Morales Praveen Reddy Priyanka K
Bank Of America
IN
this worked
Accenture
NL
this worked. thanks
Updated: 10 Jun 2020 8:46 EDT
DXC Technology
SG
Easiest and best method so far.
Siemens
This works! Simple solution
Virtusa
IN
Hi
I am also facing the same issue.
I have a grid and each record in the table has a link. Onclick of link, the file download needs to happen from a specific location. I am using activity to download the file. I am able to download one file only. If I try to download the next.... nothing happens on click.
The link "https://pdn.pega.com/support-articles/export-excel-downloads-file-only-once" is not working anymore.