Skip to main content

Table of Contents

JavaScript API for running any activity in offline mode


Only available versions of this content are shown in the dropdown

The API for running activities helps you handle use cases that are unsupported in offline mode, by calling a JavaScript method from the custom code that immediately initiates an activity on the server.

When the app is online, the server returns response data and a success method is called. When the connection is not available or the call otherwise fails, a failure method is called.

You can use the activity running feature, for example, to populate options for a drop-down control based on a property from the workpage, if you do not want to package the master list in the client store.

The API makes it possible to get filtered data from a larger amount of data that does not need to be packaged and stored in the client store. The API method passes the workpage JSON to the server and runs the specified activity in that context, so that the server filters the data, based on the workpage properties.

The API supports the ClassName.ActivityName notation so that you do not have to post any pages 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 page to the server and runs the specified activity in that context, outside of offline mode of the offline-enabled application. The returned data is passed to the success callback that is specified when calling this method.

The method has the following parameters:

Required. Specifies the name of the activity to run on the server.
Optional. Specifies a SafeURL object that holds key and value pairs for the activity parameters.
Optional. Specifies a JavaScript object that contains success and failure methods, and the scope property. The success method is called when the call is successful. The failure method is called when an error occurs during the call. The scope property specifies the scope in which the callbacks must run.
The JavaScript docs that are available in the webwb/safeURL.js text file contain a description of all SafeURL functions that are used to assemble, encode and return URLs and query strings.


You can use the following JavaScript code to run the RunActivity activity, which is part of the WW-WebWiz-Work-NoNosco class, when an offline-enabled mobile app connects to a network, and pass the parameters as key and value pairs. To call an activity on the server in the specified class, you must add the class name as a prefix 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 ) {
	// custom code 
failure: function() {
	// code to display information that the call failed
scope: window
Suggest Edit
Did you find this content helpful?

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us