Support Article
Export to CSV does not prompt to Save or Open file
Summary
A button configured to export to CSV does not prompt to save or open the exported file, the second time.
Error Messages
Not Applicable
Steps to Reproduce
- Export the results of a repeating grid using the pxConvertResultsToCSV activity.
- Configure an action set on a button click to invoke pxConvertResultsToCSV.
- Click the button multiple times. The Excel file is not downloaded for the second time
Root Cause
The download does not occur because the section is refreshed on clicking the button.
Resolution
Perform the following local-change:
- Add the below JavaScript function in the UserWorkForm.
<script>
function downloadFile1(activityName, className, applicationName, fileName, fileType){
debugger;
var suURL = SafeURL_createFromURL(pega.u.d.url);
suURL.put("pyActivity", activityName);
suURL.put("pyClassName", className);
suURL.put('ApplicationName', applicationName);
suURL.put('FileName', fileName);
suURL.put('FileType', fileType);var formEle = document.createElement('form');
formEle.id = "download_file";
formEle.method = "POST";
formEle.action = suURL.toURL();
if(pega.env.ua.webkit)
formEle.target = "";
document.body.appendChild(formEle);
formEle.submit();
document.body.removeChild(formEle);
}
</script> - Configure a Run script on the download link or button and call this function.
Published December 4, 2018 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.