Skip to main content


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

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Validate rules in offline mode

Updated on November 9, 2021

Offline-enabled mobile apps support validate rules in specific scenarios. Validate rules help you verify the correctness of the input values in your app. For example, a validate rule can test if the property values that users enter in a form are valid against conditions that you define in the rule.

The validation is automatic if a flow action references the validate rule.

Packaging

A validate rule that conforms to the supported features is packaged on the Pega Platform server for use in an offline-enabled application. A subset of the validate rule model is packaged and interpreted in the client after validation processing has finished. The validation logic is directly derived from the model.

If a validate rule that is packaged for offline use contains an unsupported action, library, or feature, it is not processed in the offline-enabled application. Pega Platform adds an error message to the log files that indicate that the validate rule was not processed.

Supported features

The following features are supported in offline-enabled applications:

  • A validate rule that is referenced by a flow action only (and also validate rules that are explicitly added to the list of offline-supported validate rules).
  • One level of validation only - one column for each property is supported.
  • Adding warning and error messages to properties and pages, if a supported validation fails.
  • Several validation conditions:

    • Enable conditions
    • Select a function
    • Required check box with a default message: This field may not be blank
    • Continue validation
    • Message as a text or a reference to a message rule with parameters
    • Validation condition with function rules
  • Only direct validation of a single-value property that is defined:

    • Individually - for example: .CustomerType.
    • In a Page property - for example: .ItemToAdd.Name.
    • In a Page List property - for example: .Items(1).CategoryID.
    • In a Page Group property - for example: .ShipmentsGroup(A).TrackingNumber.
    • In a specific page of a Page List property in a Page property, for example: .ItemToAdd.Items(1).CategoryID.
  • Localization of parameterized message rules for the validation conditions.

Unsupported features

The following features are not supported in offline-enabled applications:

  • References to a validate rule from any rule other than a flow action
  • Any modification of the validate rule configuration in the flow action rule
  • Case-level validation during case creation and saving
  • Stage-entry validation
  • Validate rules in an assignment, during postprocessing when users navigate away from a step
  • Queuing additional validation, such as Edit Validate or another validate rule, that runs after the evaluation of the preceding validation
  • Input tab settings on a validate rule: input property, proposed work status, flow action name, stages
  • Direct validation of the following single-value properties: Validate Each, Call for Each, Call
  • Validate rules with expressions

Offline validation API

The offline validation API consists of a JavaScript method that allows you to run a validate rule in offline-enabled applications by using a Run script action or a custom JavaScript function. Validate rules that are referenced by a flow action are packaged automatically. To package other validate rules, you must add their definition to the pyValidateWhitelistForOffline rule. Remember that a validation rule can also call any number of function rules. These function rules that are part of the validation rule are also packaged automatically.

The following JavaScript method is available for the pega.offline object:

MethodDescription
runValidate( validateName, className )

A synchronous method that runs a validate rule in the offline mode with the specified name and class. It returns a Boolean value specifying whether the validation was successful (true) or not (false). The method also adds messages to properties for which the validation rule failed.

The method has the following parameters:

validateNameRequired. Specifies the name of the validate rule to run.
classNameRequired. Specifies the name of the class that the validate rule belongs to.

The following sample JavaScript code allows you to run a validate rule called pzValidateMeetingTime, which belongs to the PEGA-MANAGEMENT-MEETING class.

if ( !pega.offline.runValidate( "pzValidateMeetingTime", 
        "PEGA-MANAGEMENT-MEETING" ) ) {
        console.log("Meeting cannot be set up in the past"); 
        }
  • Adding validate rules to the allow list for offline use

    Improve the user experience and test properties and pages input values of the offline-enabled application against defined conditions by adding a validate rule to the list of offline-supported validate rules. You can use these rules in custom JavaScript code.

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