The OnServerConnnectionError event is available for all pages (top pages and sub pages). A server connection error could occur while making the initial connection, or when the connection is subsequently lost. For the event that such an error occurs, you can define:
•a suitable error message to the end user (client device), and
•the subsequent actions to take.
You can also simulate a connection error in the Simulator.
|When a server connection error occurs, the first of the following actions that exists is triggered: (i) a Try/Catch Server Connection Errors action, (ii) action/s for the OnServerConnectionError event (this event), (iii) a MobileTogether message about the error, following which the workflow is resumed.
Defining what to do when there is a connection error
You can define what actions to execute when there is a server connection error. These actions are defined for each page: in the tab of the page event OnServerConnectionError. The actions you define would typically include a message to the end user and a procedure for the workflow to follow. The screenshot below shows a sequence of actions that could be performed.
The screenshot above defines a sequence of three actions to perform:
1.Send an error message to the client (screenshot below).
2.Use the MT_ServerConnectionErrorLocation variable to save the action stack that triggered the OnServerConnectionError page event. (The variable should be used for debugging purposes; see MT_ServerConnectionErrorLocation for details.) Alternatively to the MT_ServerConnectionErrorLocation variable, you can use the Update Node action to write your own error codes into a node that you specially create for this purpose.
3.Send an email to the administrator (from the client) with the error information as an attachment.
|If no action is defined in the tab of the OnServerConnectionError page event, then a generic Network access disabled message is sent to the mobile device (screenshot below):
Simulating a server connection error (for testing)
1.Start the simulation (for example, with F5). The simulator starts (screenshot below).
2.Click Prevent Server Access. Server access will be disabled, and the button will toggle into an Enable Server Access button.
3.Carry out an action that calls for a server connection. Since access is disabled, the actions defined in the OnServerConnectionError page event are triggered.
4.To enable server access again, click Enable Server Access in the simulator.