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 the Excel file on click of a button



Unable to download the Excel file on click of a button.

Error Messages

Not Applicable.

Steps to Reproduce

  1. Create an activity
  2. Call the MSOGenerateExcelFile activity in the Run Activity action set of a button
  3. Click the button on the portal to export the Excel file

Root Cause

A defect in Pegasystems’ code or rules.


Perform the following local-change:
  1. Copy the below JavaScript in the UserWorkForm HTML fragment and save it in the application ruleset:

    function downloadFile(activityNameclassNameapplicationNamefileNamefileType){ 
    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. Navigate to the Export button's Action Tab
  3. Remove the Run Activity action configured for the export activity
  4. Configure the Run Script action and call the downloadFile function
  5. Add the activityNameclassNameapplicationNamefileNamefileType and pass respective values parameters
  6. Check the two options available under security tab's Restrict access of the activity


Published August 15, 2019 - Updated December 2, 2021

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?

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