Discussion
Tata Consultancy Services
GB
Last activity: 6 Apr 2017 8:01 EDT
Calling activity from HTML in section
Hi, I am trying to call an activity and pass parameter to it from java script in a Section. I am not been able to do this. I'm using below code:
<script>
var varNameOnCard = "Biswajit";
oSafeURL =null;
var oSafeURL = new SafeURL("Grp-Data-Fin-PaymentAccount-Card.PostAuthSemafoneTest",getReqURI());
oSafeURL.put("NameOnCard", varNameOnCard )
//var strReturn = httpRequestAsynch(oSafeURL.toURL(),null, 50, 100);
//pega.util.Connect.asyncRequest('GET', oSafeURL.toURL(),'');
var strResponse = httpRequestAsynch(oSafeUrl.toURL(),"post");
</script>
However if I use the below JSP, activity is invoked correctly but I can't pass the parameter on to it from java script code. So if any body can please help understand why the former is not working. Many thanks for help.
<%
 String strNameOnCard = "Biswajit";
  ParameterPage newParams = null;
  HashStringMap keys= null;
  
  newParams = tools.getParameterPage();
  newParams.putString("NameOnCard",strNameOnCard);
  keys = new HashStringMap();
  keys.putString("pxObjClass", "Rule-Obj-Activity");
  keys.putString("pyClassName", "Grp-Data-Fin-PaymentAccount-Card");
  keys.putString("pyActivityName", "PostAuthSemafoneTest");
  tools.doActivity(keys, tools.getPrimaryPage(), newParams);
%>
***Updated by moderator: Lochan to add Categories***