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.

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 API.

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( JSON.stringify(metadata),
        JSON.stringify(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.