Offline data transform API
The offline data transform API consists of a JavaScript method that helps
you to run a data transform in offline-enabled mobile apps by using a Run script action
or a custom JavaScript function.
Offline validation is possible with the
runDataTransform JavaScript method that is available for the
pega.offline
object.Purpose
Runs a data transform with the specified name. You can run the data transform rule in the specified page context.
Signature
runDataTransform(
datatransformName, className, pageName, callback )
Parameters
Name | Description | Type | Required |
---|---|---|---|
datatransformName | Specifies the name of the data transform to run. | String | ✅ |
className | Specifies the name of the class to which the data transform belongs. | String | ✅ |
pageName | Specifies the name of page (page context) in which to run the data transform. If you do not specify this parameter or set the parameter to a null value, the data transform runs in the primary page context. | String | ❌ |
callback | Specifies a JavaScript object that contains success and fail methods. The success method is called when the data transform has been run successfully. The fail method is called when an error occurs after a data transform run. | Function | ❌ |
In the following example, JavaScript code runs the SampleDT
data
transform of the MY-SAMPLE-WORK-DATATRANSFORMS
class, in the primary
page context, from a custom JavaScript function:
var offlineDTCallback = {
success: function() {
console.log("Data transform ran successfully");
}
fail: function() {
console.log("Failed to run Data transform");
}
};
pega.offline.runDataTranform( "SampleDT",
"MY-SAMPLE-WORK-DATATRANSFORMS",
null,
offlineDTCallback);