Question
Call activity on pyModalFlowTemplate close icon not working
Requirement:
Need to execute an activity(before modal dialog closes) on click of close icon on top right corner of modal dialog.
Solution tried:
Customized pyModalFlowTemplate, pzModalHeader and pzModalClose sections.
Done a save as of pzModalClose to ModalClose and replaced the original code with custom code. But the javascript function is not getting executed.
Even tried inspecting with close button and put a OnClick=debugger; on it. it still didn't stop on click.
Original code in pzModalClose:
<div class="hd" id="modaldialog_hd"> <span id="modaldialog_hd_title"><pega:include type="Rule-HTML-Property" name="pzModalTitle"/></span> <pega:include name="pzModalHelp" type="Rule-HTML-Property" /> <pega:include name="ModalClose" type="Rule-HTML-Property" /> </div>
Modified Above code to(Added JS function call Onclick to execute the activity):
<body> <button type="button" class='container-close' id="container_close" onClick="myFunction()" title="<%= tools.getLocalizedTextForString(".pyCaption", "close modal") %>"></button>
<script>
function myFunction(){ debugger; var setPropURL = new URL('<classname.activityname>');
var paramData = new URL();
// paramData.put("ParamPropertyName","Value");
var callback;
var request = pega.util.connect.asyncRequest('POST', setPropURL.toURL(),callback,paramData.toEncodedPostBody()); }
</script>
</body>
Please suggest how to execute an activity on click on close icon on modal(top right) before closing the modal window.
How about putting the activity in the post processing of the flow action that is referred in the modal?
-Saikat