callActivity action as an extension

You can indirectly invoke any activity in the mobile app when it is offline to handle use cases that are not supported. For instance, to perform additional tasks such as updating the details of a work object. This is accomplished by calling the callActivity action as an extension using the local storage JavaScript API - you need to use the Run script action and create a JavaScript function that will contain some of the sample code shown below. The invoked action is packaged in the queue to be executed when the app comes back online.

Note: If the offline-enabled application is online and the service is accessible, it is possible to force the queue to be sent to the server immediately without having to tap on the offline indicator. This is achieved by calling the datasyncStart() function.

Example of calling an activity

The callActivity action is called via the addAction() method for the window.pms.plugins.clientstore object, as shown below. 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: It is not possible to use any of the clipboard pages currently loaded in the main user session. As such, if you open a work object on the server, the callActivity action cannot access the current workpage - it is the responsibility of the developer to load any clipboard pages before applying the changes. As best practice, use pyWorkPage, newAssignPage, pxRequestor and data pages.