Support Article
Download file does not work
SA-87002
SUMMAR
A link is configured in the application to download a file. Post upgrade to Pega 8.1, the download link does not work.
Error Messages
Not Applicable
Steps to Reproduce
- Configure a link on click of which the 'Refresh this Section' action is invoked.
- Invoke the out-of-the-box DownloadFileByName activity.
- Click the link. The file is not downloaded.
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 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('File',fileName);
suURL.put('Type', fileType);
suURL.put('Application',applicationName);
var formEle = document.createElement('form');
formEle.id= "download_file";
formEle.method = "POST";
formEle.action = suURL.toURL();
if(pega.env.ua.webkit)
formEle.targe t= "";
document.body.appendChild(formEle);
formEle.submit();
document.body.removeChild(formEle);
}
</script>
- Configure the RunScript on the Download link.
- Invoke this function.
Published December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.