Support Article
Unable to download Excel on clicking button the second time
SA-85514
Summary
Excel file does not download at the user end on clicking the Download button the second time.
Error Messages
Not Applicable
Steps to Reproduce
- Configure a button.
- Click the button to invoke the Refresh-this Section action.
- Set the Call Rule-Obj-HTML.ViewExportToExcelactivity to download the Excel file.
- Click the button once to download the file. The file downloads.
- Click the button a second time.
Root Cause
A software use or operation error.
This is an unsupported implementation of the activity to download the file.
Resolution
Perform the following local-change:
- Copy the below JavaScript function in the UserWorkForm.
<script>
function downloadFile(activityName, className, applicationName, fileName, fileType){
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 the Run script on the download link and invoke the function.
Published August 15, 2019 - 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.