getEnvironment(code)

rich.getEnvironment(code) reads one environment slot of the rich client synchronously from the bridge member osjxGetEnvironment(code). It is a method of the rich-client handle — the handle is obtained once via dashlet.getRichClientApi() and its methods read the bridge per call (lazily, no snapshot).

1. Signature

getEnvironment(code: number): string | null;

2. Parameters

Name Type Description

code

number

The environment slot code (one of the documented slots below, or any other number — an unknown slot yields null, not the marker).

3. Behavior

The bridge member osjxGetEnvironment(code) is called synchronously, per call — the bridge is read lazily at call time (a bridge surface that is reduced or swapped later becomes visible immediately; no snapshot is kept). The returned string is delivered verbatim, with no trimming: slot 10 (client version) keeps its trailing space (e.g. '12.0.702 ').

Slot Meaning Note

3

User login name

10

Client version

Raw value: the trailing space is preserved (trimmed/normalized only in InitContext.clientVersion).

14

Full user name

16

User e-mail

18

User GUID

24

Language (GUI short code, e.g. eng, de)

'' is a real value — version 10.10 delivers empty values at start (warm-up, see below).

27

Session GUID

other

Not documented

The host marker "Unbekannter Parameter: N" is filtered — the method yields null instead of the marker.

null and '' are strictly distinct: null means "not readable" (absent or non-function member, a throwing call, a non-string result, or an unknown slot whose host marker was filtered); '' is a real empty value and is preserved. To tell apart an unknown slot from an absent member, use rich.has('osjxGetEnvironment') (see rich-client handle).

v10.10 warm-up. On client version 10.10, osjxGetEnvironment(n) returns empty values at client start until the warm-up completes — a getEnvironment(…) call before the warm-up ends therefore yields '' (the real empty value), and the actual value afterwards. The library itself runs a bounded warm-up with a refresh and re-emission of the context; see Environments — v10.10 warm-up.

4. Examples

const lang = rich.getEnvironment(24);   // 'eng'
const version = rich.getEnvironment(10); // '12.0.702 ' (trailing space kept)

5. Errors

Bridge problems never surface as a throw from getEnvironment — the read path yields null instead (missing member, throwing call, unknown slot). The hard errors listed here come from the handle accessor dashlet.getRichClientApi():

  • Error('dashlet destroyed') — the dashlet was destroyed (accessor and handle methods).

  • TypeError: Dashlet.getRichClientApi(): the environment is not resolved yet - await the dashlet.init promise first — the accessor was called before the environment was resolved.

  • TypeError: Dashlet.getRichClientApi(): the rich client API handle is only available in the richClient environment (current: …) — the accessor was called in the wrong environment (the current value is named).