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

Screen is loading after the file downloads



After downloading the file, browser is throwing 'pega' is undefined java script error.

Error Messages

Message: 'pega' is undefined
Line: 1
Char: 6236
Code: 0
URI: http://hotname/prweb/PRServlet/mUevMtvcJErF3ChTkHbdGuhP7adKLV4F*/webwb/pzpega_ui_grid_1512520753.js!pzpega_ui_grid_dragdrop_13859374587.js!pega_yui_resize_1400790147.js!!.js

Steps to Reproduce

 Configure a button to download an excel file and refresh this screen.

Root Cause

A software use or operation error : downloading a file in Ajax request(refresh section) is not supported. This will cause many issues, as it disrupts Ajax.


Perform the following local-change: 

1. Paste the below script in UserWorkForm 

getFileToClient = function() { 
var strUrlSF = new SafeURL("@baseclass.ExportToExcel"); //replace with necessary activity and pass appropriate params 
var strUrl = pega.u.d.url +"&"+ strUrlSF.toQueryString(); 
var ifrm = document.getElementById("fileDownloadIframe"); 
ifrm = document.createElement("iframe"); 
ifrm.setAttribute("id", "fileDownloadIframe"); 

ifrm.setAttribute("src", strUrl); 

2. Configure Run Script on the export to excel button to call the above method, that is getFileToClient

Published February 15, 2016 - 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?

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