Show TOC

Managing UI and Server MessagesLocate this document in the navigation structure

SAPUI5 provides a central management of UI and server messages.

Messages notify the user about specific states of the application. The following two message types exist:

  • UI messages (client side) refer to a control; they are created from the input validation and by the application itself.

  • Server messages refer to a binding path; they are managed by the server and are changed every time the back end responds to a request.

A message contains at least the following information:

  • ID: The ID is usually set automatically on message creation.

  • Type: Possible types are error, warning, and info; see sap.ui.core.MessageType in the API reference

  • Target: Describes to what part of the application the message applies this could be, for example, a control property; if the target is empty, the message applies to the entire application

  • Message processor: Object that handles the message in the application

  • Message text: Text that is displayed to the user

In addition to this information, a message can contain the following optional information:

  • Description: Message long text

  • Code: Machine-readable version of the message; this is usually provided by the back end to allow to look-up details

  • technical property: This property is set if a technical error occurs; it is usually set if an error code is sent from the back end, like a 404

  • persistent property: If this property is set to true, the messages are not deleted automatically; the application handles the life cycle of these messages

Message Life Cycle
The MessageManager handles the message life cycle, which is different for UI and server messages:
  • UI messages are added with a target referencing a control and its specific property. The messages are kept until a validation message for the property is created and assigned. If new data for the same property is received from the server, the UI messages are erased unless their persistent property is set to true.

  • Server messages are kept until a message from the server for the same path arrives. The server always sends all messages for a specific target, which means that all current messages are replaced with the ones sent by the server.

Message Manager

The message manager manages all messages for the application. MessageManager is available globally as a Singleton by calling sap.ui.get.core().getMessageManager().