Support Article
Unload to download a file multiple times
SA-76048
Summary
Unload to download a file multiple times. The file is downloaded only the first time. Additionally, Refresh section does not work correctly.
Error Messages
Not Applicable
Steps to Reproduce
- Configure a button to download a Word or Excel file.
- Call the activity in the RefreshSection action. File download occurs only the first time.
Root Cause
A defect in Pegasystems’ code or rules.
The section was refreshed and the activity call did not occur.
Resolution
Perform the following local-change:
- For multiple file downloads, include the following script in UserWorkForm,
<script>
function downloadFile(activityName, className, applicationName, fileName, fileType){
varsuURL = 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);
varformEle = 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>
- Call the downloadFile method in the runScript action.
//In order to refresh the section after executing the script.
- Use the Wait method in any activity and call that activity using the runActivity action.
- After the runActivity action, provide the RefreshSection as the third action in the button action set.
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.