Close popover

Table of Contents

JavaScript API for scheduling any activity in offline mode


The API for scheduling activities helps you handle use cases that are unsupported in offline mode, by calling a JavaScript method that places any activity in the action queue. The actions are then run when the mobile app comes back online.

The app does not wait for a response from the scheduled activity.

You can use the activity scheduling feature, for example, to send a request for additional attachments to the originator of a case.

You can combine features from different APIs. For example, you can use data synchronization API methods to send the queue to the server immediately. For more information, see Data synchronization JavaScript API.


You can use the Run script action and create a JavaScript function that contains your code, similarly to the following sample code. In the example, you call the callActivity activity through the addAction() method for the window.pms.plugins.clientstore object. The data represents the primary page against which the activity is executed, and the parameters JSON array represents the list of parameters to set on the Parameter page.

var metadata = { "action":"callActivity", "activityName":"TestActivity", "className" :"PegaSample", "parameters": [ {"param1":"foo"}, {"param2":"bar"} ] }; var data = { "pxCreateDateTime": "20140421T215505.976 GMT", "LastName":"Smith", "FirstName":"Joe", "Language":"English", "pxObjClass":"Data-" }; window.pms.plugins.clientstore.addAction( JSON.stringify(metadata), JSON.stringify(data) );
You cannot use any of the currently-loaded clipboard pages in the main user session. If you open a work object on the server, the callActivity action cannot access the current workpage. You must load any required clipboard pages before applying the changes, for example, you can use the pyWorkPage, newAssignPage, pxRequestor pages and data pages.

  • Creating an activity

    Create an activity by selecting Activity from the Technical category.

  • Understanding offline data synchronization

    When an offline-enabled mobile app is not connected to a network, an action queue stores local user actions. When network connectivity is restored, the contents of the action queue are pushed to the server, and Pega Platform processes them. At the same time, all modified data pages and work objects are synchronized to the mobile device.

Have a question? Get answers now.

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