Skip to content

Server calls in form events (ServerCallsInFormEvents)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Error BSL Critical Yes 15 design

Description

Events OnActivateRow and OnStartChoice should not contain server procedure calls. These events should only execute on the client.

Only server calls to methods of this form are diagnosed; calling MyModuleServer.MyServerMethod will not result in an error.

According to the Infostart article, calling server procedures from these events can lead to performance issues and form behavior problems.

Examples

Incorrect

&AtClient
Procedure OnActivateRow(Element, SelectedRow, Field, NewValue, StandardProcessing)
    // Error: server procedure call from client event
    TableFormOnActivateRowAtServer();
    StandardProcessing = False;
EndProcedure

&AtServer
Procedure TableFormOnActivateRowAtServer()
    RaiseException "test";
EndProcedure

Correct

Procedure OnActivateRow(Element, SelectedRow, Field, NewValue, StandardProcessing)
    // Correct: only client-side processing
    StandardProcessing = False;
EndProcedure

Sources

Snippets

Diagnostic ignorance in code

// BSLLS:ServerCallsInFormEvents-off
// BSLLS:ServerCallsInFormEvents-on

Parameter for config

"ServerCallsInFormEvents": false