Error and warning handling in offline mode
To signal to the user general, warning, or error events in the offline process engine for an offline-enabled application, you can add, clear, or check for informational, warning, or error messages on a page and its properties. Adding, clearing or checking for informational, warning, or error messages takes place during the post-processing of the flow action that a Pega Platform developer implements as a JavaScript hook. For example, you can use error handling to validate whether a value entered in a property or page is in the correct format.
Offline informational, warning, or error messages work in a similar way to the way that they work on Pega Platform desktop applications. Field-level (property) messages take precedence over form-level (page) messages. When the field-level messages are not available, form messages are shown. You can submit a form if such errors exist on a page or its properties, but you cannot move the flow forward until all the errors that are described in the message are resolved. You can move the flow forward if you changed the informational or warning messages state.
When processing cases in an offline-enabled application, you can use several JavaScript functions to handle informational, warning, and error messages. The JavaScript error and warning handling API provides several methods for clearing and setting messages according to their post-processing logic. The error handling API allows you to take the following actions.
- Determine whether an informational, a warning, or an error condition results from the post-processing of the flow action.
- Obtain the total number of informational, warning, or error messages for a page, a property, or both.
- Check whether a page or a property has informational, warning, or error messages.
- Add informational, warning, or error messages to a page, a property, or both.
- Clear all informational, warning, and error messages from a page or a property.
- Change the informational, warning, or error message state to added, presented, or submitted.