Close popover
Shweta Bhatia (ShwetaB2746)
Ernst & Young LLP

Ernst & Young LLP
ShwetaB2746 Member since 2020 18 posts
Ernst & Young LLP
Posted: June 17, 2020
Last activity: June 20, 2020

Activity is not getting called from a HTML

Hi All,

Have written an HTML rule and on the click of the below button trying to call an activity. 

<div class="divbutton"> <button class="button button2" name="Accept" type="button" onclick="validate()">ACCEPT</button> </div>

The following code snippets have been tried :

Code 1:

<script type="text/javascript">     function validate(){              var suURL = SafeURL_createFromURL(pega.u.d.url);          suURL.put("pyActivity", "UpdateAvailedPrivacyNotice");          suURL.put("pyClassName", "Data-Portal");             warningFlagEnabled= httpRequestAsynch(suURL.toURL(),"", 50, 100);       alert("Activity executed");     }   </script>


Code 2: 

<script type="text/javascript">     function validate(){             var xmlhttp;       if(window.XMLHttpRequest){         xmlhttp=new XMLHttpRequest();       }else{         xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");       }              var strWorkURL = new SafeURL();       strWorkURL.put("pyActivity","Data-Portal.UpdateAvailedPrivacyNotice")"GET",strWorkURL.toURL(),false);       xmlhttp.send(null);       alert("Activity executed");    location.reload(true);     }   </script>


Have also done the below changes in Activity as attached.



***Edited by Moderator Marissa to update Platform Capability tags****

Pega Platform 8.3.1 User Experience