Question

3
Replies
44
Views
Close popover
Adithya Kurmachalam (AdithyaK9774)
Morgan Stanley

Morgan Stanley
IN
AdithyaK9774 Member since 2020 3 posts
Morgan Stanley
Posted: 4 weeks ago
Last activity: 1 week ago

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.

 

***Edited by Moderator: Pooja Gadige to change content format from Discussion to Question***
Pega Platform 8.5.1 User Experience