Skip to content

BSL244 — Server calls in form events

Summary

Server calls in form events

Identifiers

Field Value
Rule code BSL244
Compatible alias ServerCallsInFormEvents
Severity ERROR
Enabled by default Yes
Implemented Yes
Tags correctness, ui, performance

Behavior

  • The public identifier BSL244 and alias ServerCallsInFormEvents are stable.
  • The rule reports the cases documented on this page.
  • Suppressions and project configuration are applied before publication.
  • The rule requires neither an external analyzer nor network access.

Configuration and suppression

BSL### is the primary stable identifier. The compatible alias is accepted in select, ignore, and compatible block suppression comments.

[tool.onec-hbk-bsl]
select = ["BSL244"]
ignore = ["ServerCallsInFormEvents"]

All three suppression families support both a current line and a range. When an opening comment follows code, it affects only that line. Use any one form:

  • noqa:
Value = "example";  // noqa: BSL244
  • bsl-disable:
Value = "example";  // bsl-disable: BSL244
  • compatible BSLLS form:
Value = "example";  // BSLLS:ServerCallsInFormEvents-off

When the same opening comment is on a line by itself, it starts a range. Close it with the matching marker from the same family:

// noqa: BSL244
// code without this diagnostic
// noqa-enable: BSL244

// bsl-disable: BSL244
// code without this diagnostic
// bsl-enable: BSL244

// BSLLS:ServerCallsInFormEvents-off
// code without this diagnostic
// BSLLS:ServerCallsInFormEvents-on

To disable the rule until the end of the file, omit the closing noqa-enable, bsl-enable, or BSLLS:…-on marker.

Opening and closing markers must belong to the same family.

Description

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

Only server calls to methods of this form executed within the server context (&AtServer) are diagnosed. Calling general modules (e.g., MyModuleServer.MyServerMethod) or non-contextual server procedures of the form itself (&AtServerNoContext) 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

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

&AtServerNoContext
Procedure OnActivateRow(Element, SelectedRow, Field, NewValue, StandardProcessing)
    // Correct: non-context server form calls are allowed
    StandardProcessing = False;
EndProcedure

Sources