This document discusses several ways to call activities and functions from JavaScript in Pega:
1. Use the SafeURL class to construct a URL and call an activity asynchronously via httpRequestAsynch.
2. Open a modal or non-modal window to an activity URL using methods like openUrlInWindow.
3. Reload a section on the page by calling pega.u.d.reloadSection from an activity.
4. Call a built-in utility function using <% %> tags within a JavaScript function.
5. Trigger a flow action using doFormSubmit to submit parameters and start an activity.
6. Modify the @baseclass.IsAPegaDevelop
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
623 views
Javascript Coding
This document discusses several ways to call activities and functions from JavaScript in Pega:
1. Use the SafeURL class to construct a URL and call an activity asynchronously via httpRequestAsynch.
2. Open a modal or non-modal window to an activity URL using methods like openUrlInWindow.
3. Reload a section on the page by calling pega.u.d.reloadSection from an activity.
4. Call a built-in utility function using <% %> tags within a JavaScript function.
5. Trigger a flow action using doFormSubmit to submit parameters and start an activity.
6. Modify the @baseclass.IsAPegaDevelop
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3
Q) How to call an Activity rule from JavaScript?
Try this. In your function write this code.
var oSafeURL = new SafeURL("Class Name Of The Activity.Activity Name"); oSafeURL.put("ABC", parameter); // use it if parameter if required var strReturn = httpRequestAsynch(oSafeURL.toURL(),null, 50, 100); In Javascript you can use below command runActivity("Class Name Of The Activity.Activity Name") Q) To call an activity using java script : 1) var bSafeURL= new SafeURL("A-B-C.ActivityName"); bSafeURL.put("param1",value1); bSafeURL.put("param1",value2); pega.util.Connect.asyncRequest('GET', bSafeURL.toURL(),'');
2) var oSafeURL = new SafeURL("@baseclass.testActivity"); oSafeURL.put("ClassName", insName); var strRuleXml = httpRequestAsynch( oSafeURL.toURL(), null, 50, 100);
apart from there there lot other ways to do it.
Some ways that we can achive a call to activity and open popup window / model w indow
var objSafeUrl = new SafeURL("A-B-C.Activity Name"); var contentWin = showModalDialog(objSafeUrl.toURL(), strWindowName , "width:500 ;height:600;resizable: yes; scroll: yes; help: no;");
4) var objSafeUrl = new SafeURL("A-B-C.Activity Name"); windowOptions = "width:500;height:600;resizable: yes; scroll: yes; help: no"; openUrlInWindow(objSafeUrl .toURL(),"WINDOWNAME",windowOptions,false); =============================================================================== ====== I am using below code to call the activity from javascript. And I want to receiv e multiple parameters back inside control. I am using show-property inside activity to take one parameter back to control. Is there anything like bSafeURL.put("param3",value3); to recive output parameter in activity back to control? var bSafeURL= new SafeURL("A-B-C.ActivityName"); bSafeURL.put("param1",value1); bSafeURL.put("param1",value2); you can return mulitple values in show-property Method. you can try like Param.ReturnValues="Value1 :"+.value1+","+"Value2 :"+.value2 or Param.ReturnValues=.value1+","+.value2
AND use this Param in the show-property . In java script , you can parse CSV. ================================================================================ ========= Q)how to call a javascript from activity to refresh screen rather than call show -harness? pega.u.d.reloadSection(pega.u.d.getSectionByName("<Section Name>","",""),"<Activ ity Name>",'', false, true, '-1', false); ================================================================================ ========== Q) How to call OOTB utility/function in javascript? function test (){ <% rulesetname_libraryname.SomeFunctionName (parameters); %> } ================================================================================ ============== Q) How to call a FlowAction from JavaScript? <button type='button' class='pzhc' data-ctl data-click='[["setUserStart",["FINIS HASSIGNMENT"]],["doFormSubmit",["pyActivity=FinishAssignment",":this","Submittin g...",":event"]]]' title= 'Complete this assignment' > <div class='pzbtn-lft' ><div class='pzbtn-rgt'><div class='pzbtn-mid' data-click ='...'><img class='pzbtn-i'/> Next >></div></div></div></button> Or this one on onclick event '[["setUserStart",["FINISHASSIGNMENT"]],["doFormSubmit",["pyActivity=FinishAssig nment",":this","Submitting...",":event"]]]' ================================================================================ ==================== Q) how to enable Pegadeveloper javascript apiPrint how to enable Pegadeveloper j avascript api? Take the private checkout of @baseclass.IsAPegaDeveloper when rule and modify th e when condition like @IsInRuleSetList("Pega-RULES") Equal true. Now save the rule it will work. This is a temporary solution.