Skip to content

context.Error

Overview

If an error occurs before creating, updating, or deleting a "Record" in the "Server Script", the process is canceled and an error message is displayed on the screen. The server script does not stop in the middle of the process.

Limitations

  1. When context.Error is set, the server script is processed, but only the error message is returned to the client. Therefore, the processing following context.Error is performed on the server, but is not reflected in the form on the client.
  2. This is valid when the "Condition" of the server script is "Before Create", "Before Update", or "Before Delete".

Syntax

context.Error(message);

Parameters

Parameter Type Required Overview
message string Yes error message

Return Value

There is no return value.

Usage Examples

In the example below, when a user with department ID 3 tries to update the "Status Column" to Complete, the operation is canceled and an error message is displayed. The condition is checked as "Before Update".

JavaScript
try {
    if (context.DeptId === 3 && model.Status === 900) {
        context.Error('Update cancelled because conditions were met.');
    }
} catch (e) {
    context.Log(e.stack);
}