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

Unable to download Excel on clicking button the second time

SA-85514

Summary



Excel file does not download at the user end on clicking the Download button the second time.


Error Messages



Not Applicable


Steps to Reproduce

  1. Configure a button.
  2. Click the button to invoke the Refresh-this Section action.
  3. Set the Call Rule-Obj-HTML.ViewExportToExcelactivity to download the Excel file.
  4. Click the button once to download the file. The file downloads.
  5. Click the button a second time.


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: 
  1. Copy the below 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 the Run script on the download link and invoke the function.

Published August 15, 2019 - Updated October 8, 2020

Was this useful?

0% 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?

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