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

Fail to customize buttons for Exporting to Excel and PDF

SA-16007

Summary



The requirement is to export all the records when clicked on Export to Excel or PDF in list view and summary view with paging enabled. But due to paging, the default behavior fetches only the current page records.
User tried to customize buttons using HTML fragment. Direct list views work fine with it, however, for summary view, unable to pass the drilldown parameter.


Error Messages



Not Applicable


Steps to Reproduce



1. Create HTML fragment with the function to call activity (activity which is based on the parameter passed will call two different functions , one for activity to download excel for all records, another based on parameter value)
2. Use the HTML in custom script and provide the function name in export excel button.

 

Root Cause



A software use or operation error. 
User was trying to call activity from javascript function but they were not passing any parameter to activity from function due to which, in the activity, When condition was failing based on the expected parameter value. Based on When condition logic, with the parameter value, two functions were called accordingly. Since the parameter was null, every time it was looping back to the failed condition.

 

Resolution



Perform the following local-change:

1. Use the below code in HTML fragment to get the OpID parameter value and store it in hidden input element.

<%
String OpID = tools.getParamValue("OpID");
tools.appendString("<input type=hidden id=paramID value=\""+ OpID +"\">");
%>

2. Get the hidden input element value on click of "Export to Excel" button and pass that value to the export activity.
3. Use the following references to call activity with parameters from javascript function.

<script>
function ExportExcel(){
var OpID = document.getElementById("paramID").value;
var windowProps = 'toolbar=no,location=no,menubar=no,status=yes,scrollbars=yes,resizable=yes,width=750,height=600';
var URL = new SafeURL("ClassName.ActivityName"); //Replace ClassName with name of the Applies To class and ActivityName with name of your export activity
URL.put("OpID",OpID);
url = URL.toURL();
window.open(url,"_self", windowProps);
}
</script>

Please refer the below PDN forum links for more information.

https://pdn.pega.com/forums/prpc/general-questions/calling-an-activity-from-javascript-and-pass-the-parameters
https://pdn.pega.com/forums/prpc/java-activities/calling-an-acticity-from-javascript
https://pdn.pega.com/forums/call-activity-from-javascript/call-activity-from-javascript-using-post-method

4. Use Param.OpID in the activity and listview to get the parameter.

 

Published January 31, 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?

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