Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Document download is performed only for the link clicked first

SA-30316

 

Summary

There are multiple links configured to download different documents. However, document download occurs only when the first link is clicked.

Error Messages

Not Applicable

Steps to Reproduce

  1. Create a section with multiple links.
  2. Add an action or event combo for the links: onClick, Section Refresh, and activity pyDownloadBinaryFile.
  3. Click a link to a download file.
  4. Click another link to download a different file.

Root Cause

The section refreshes on the click of the link and this causes the issue.

Resolution

Perform the following local-change:

1. Copy the following 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>


2. Configure run script on download of the link and call this function.

Published April 12, 2017 - Updated July 22, 2021

Was this useful?

71% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us