Support Article
Export to Excel Not working
SA-82707
Summary
The user has configured a button on click of which Export to Excel occurs. The process fails on clicking the button a second time.
Error Messages
Not Applicable
Steps to Reproduce
- Open the application.
- Configure a button. On click of the button, Export to Excel occurs.
- Click the button the second time.
Root Cause
Using the Refresh Section on the button click action to export the file is not recommended because the section is refreshed and the file cannot be downloaded the second time.
Resolution
Perform the following local-change:
- Copy the below JavaScript in the UserWorkForm.
<script>
function downloadFile(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>
- Save it in the client ruleset.
Published August 19, 2019 - Updated December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.