How to call an activity from the client using the "asyncRequest" JavaScript function

Here is an example where we invoke the pyUtilityStub activity using the POST method by sending GET and POST parameters at the same time:

var oSafeURL = new SafeURL("@baseclass.pyUtilityStub");
oSafeURL.put("pzPrimaryPageName", "pyWorkPage");
oSafeURL.put("parameterGet1", "valueGet1");
oSafeURL.put("parameterGet2", "valueGet2");

var postData = new SafeURL();
postData.put("parameterPost1", "valuePost1");
postData.put("parameterPost2", "valuePost2");

pega.u.d.asyncRequest("POST", oSafeURL, null, postData);

This function is defined in the webwb pzpega_ui_doc_ajaxengine js Text File rule.

The parameters will be sent to the activity and we can verify it using the Tracer.

Reference:

- https://collaborate.pega.com/question/how-run-activity-through-javascript

Comments

Popular posts from this blog