Question
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") xmlhttp.open("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****
Hi Swetha,
Please use the code like below.
var oSafeUrl = new SafeURL("OCRBU0-Passport-Work-PassportRegistration.ReactPropertySetter",getReqURI());
oSafeUrl.put('propertyName',this.state.name);
oSafeUrl.put('propertyValue',newval);
var strResponse = httpRequestAsynch(oSafeUrl.toURL(),"post");
Still if you get the issue, please check your browser console.log() if any issues are there. If there are any issues in activity Please share the log as well.