Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

JavaScript API for scheduling any activity in offline mode

Updated on February 23, 2022

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.

Note: 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 APIs.

Example

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(metadata, data);
Note: 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.
  • Previous topic JavaScript API for running any activity in offline mode
  • Next topic Adjusting the performance of offline-enabled mobile apps

Have a question? Get answers now.

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

Did you find this content helpful?

Want to help us improve this content?

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

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us