Support Article

Document download is performed only for the link clicked first



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.


Perform the following local-change:

1. Copy the following JavaScript function in the UserWorkForm.
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'); = "download_file";
formEle.method = "POST";
formEle.action = suURL.toURL();
if( = "";

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

Published April 12, 2017 - Updated October 8, 2020

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.