Offline-enabled applications always run in offline mode with online mode being a special case of offline mode that is referred to as OSCO. At times, you might need to run a Pega Platform activity on the server, outside of the default OSCO mode in which an activity is not yet supported. To enable an unsupported activity in offline mode, you must use the OSCO breakout API in custom JavaScript code.
The OSCO breakout API makes it possible to get filtered data from a larger amount of data that does not need to packaged and stored on the client store. The API method passes the work page JSON to the server and runs the specified activity in that context so that the data is filtered on the server, based on the work page properties. For example, you can use this API to populate options for a drop-down control based on a property from the work page, if you do not want to package the master list on the client store.
This API also supports the ClassName.ActivityName notation so that you do not have to post any page to the server. You run the activity in the server context and return the result to the callback. For example, you can use this API for a search box control that works only in online mode.
The following JavaScript method is available for the ServerProxy
object:
Method |
Description |
||||||
executeBreakoutCall( activityName, activityParams, callback )
|
Posts the pyWorkPage to the server and runs the specified activity in that context, outside of the OSCO mode of the offline-enabled application. The returned data is passed to the success callback specified when calling this method. The method has the following parameters:
|
To obtain a description of all safeURL
functions that are used to assemble, encode and return URLs and query strings, open the webwb/safeURL.js text file rule and display the JavaScript docs.
You can use the following JavaScript code to run the RunActivity activity that belongs to the WW-WebWiz-Work-NoNosco class outside of the normal OSCO mode for an offline-enabled application, passing two key/value parameters. To call an activity on the server in the specified class, make sure to prepend the class name to the activity name in the activityName parameter.
var oSafeURL = new SafeURL(); oSafeURL.put("InsHandle", "actual_handle"); pega.u.d.ServerProxy.executeBreakoutCall(“WW-WebWiz-Work-NONOsco.RunActivity” , osafeURL, { success: function( data ) { // add custom code }, failure: function() { // display information that the call failed }, scope: window });