Data transform support in offline mode

You can use data transforms in offline-enabled applications. This capability improves the developer experience working with Pega Platform data in offline mode by reducing the need for writing your own custom JavaScript functions.

A data transform rule XML is packaged on the Pega Platform server for use in an offline-enabled application. The logic in the data transform XML is then converted to an equivalent JavaScript code on the client, the application itself.

Packaging

Data transforms in offline-enabled applications are packaged, by default, when they are configured on:

  • Flow connectors
  • Flow actions as preprocessing or postprocessing data transforms
  • Refresh actions on controls in a section
  • Data transform actions (in either the primary page context or another page context) on controls in a section

The structure of the packaged data transform rules resembles the original XML model of the data transform rule and contains only the relevant parts for offline use. If a data transform rule packaged for offline use contains an unsupported action, library, function, or feature, it will not be processed in the offline-enabled application. The system logs an error message that indicates that the data transform was not processed.

If a data transform is run in an offline-enabled application by a Run script action or a custom JavaScript function, it is not packaged, by default. Instead, you must use the Offline Data Transform JavaScript API. To package a data transform rule in either scenario, you must explicitly add the data transform definition to the pyDataTransformWhitelistForOffline rule, as either the pxInsName of the data transform, or a list of pxInsName strings, if multiple data transforms need to be added.

Note: So that performance is not adversely affected, whether a data transform is marked as valid for offline use is determined at design time. Beginning with Pega 7.2.2, all data transform rules that are saved or created are marked as valid for offline use. However, to mark any existing data transforms from previous releases as valid for offline use, you need to explicitly revalidate and save them.

Supported actions

The following actions are supported for data transforms in offline-enabled applications:

  • Set
  • Update page
  • Append to
  • Append and map to
  • Remove
  • When
  • Otherwise when
  • Otherwise

The following table lists invalid configurations for supported actions:

Invalid configuration Description
A source field contains (@) outside of the quotation marks (" "). Library functions are not supported in offline mode. Configure the source field to contain expressions such as '+' or spaces, as an alternative solution.
A condition contains @. Library functions are not supported in offline mode. Use client-side expressions, as an alternative solution.
A condition does not contain a dot (.). Server-side When conditions are not supported. Use client-side expressions, as an alternative solution.