Skip to content

Other BO types

Some Business Object types expose only a value or a type to code: Configuration Items as This.$Config.<ItemName>, Roles as This.$Roles.<RoleName>, Permissions as This.$Permissions.<PermissionName>, and Data Types as This.<DataTypeName>. Languages, Themes and Access Controls have nothing to call.

Availability: Everywhere

Business Object typeAccess pathGrouped under a $ namespace
Configuration ItemThis.$Config.<ItemName>Yes. This.<ItemName> does not work.
RoleThis.$Roles.<RoleName>Yes. This.<RoleName> does not work.
PermissionThis.$Permissions.<PermissionName>Yes. This.<PermissionName> does not work.
Data TypeThis.<DataTypeName>, as a type onlyNo.
Language, Theme, Access ControlNothing to reach—

This.$ModuleId holds the ID of the Module itself.

const $Config: {
<ItemName>: { '<propertyName>': <type>, … }
}

The Module’s Configuration Items, each an object with one field per property. The values are the ones configured for this Lowgile instance when the code was compiled. A property without a configured value has its default value, or null if it has none.

const sender = This.$Config.MailSettings.senderAddress

Each read of This.$Config.<ItemName> returns a new object, so assigning to its fields changes nothing.

Client-side and shared code only get the properties marked as available on the client. A Configuration Item without such properties is missing there entirely.

Type: an object with one field per Configuration Item · Availability: Everywhere

const $Roles: {
'<RoleName>': '<ModuleId>.<RoleName>'
}

The Module’s Roles, each as a string constant holding its qualified name. Roles have no methods: to check whether the current End user has a Role, pass the constant to the user object of Sys.User.

// server-side
if (Sys.User.currentUser?.hasEffectiveRole(This.$Roles.Approver)) {
// …
}
// client-side
if (Sys.User.currentUser?.hasRole(This.$Roles.Approver)) {
// …
}

On the server, hasEffectiveRole() also counts Roles the End user has through other Roles or from the identity provider; hasDirectRole() counts only Roles assigned directly. On the client, hasRole() checks the Role names the server sent for the logged-in End user. Sys.User.currentUser is empty when nobody is logged in, hence the ?.. In shared code the user object can be of either type, so only hasPermission() type-checks there.

Type: an object with one string constant per Role · Availability: Everywhere

const $Permissions: {
'<PermissionName>': '<ModuleId>.<PermissionName>'
}

The Module’s Permissions, each as a string constant holding its qualified name. Like Roles, Permissions are checked through the user object of Sys.User; hasPermission() exists on both sides.

if (Sys.User.currentUser?.hasPermission(This.$Permissions.ApproveOrders)) {
// …
}

Type: an object with one string constant per Permission · Availability: Everywhere

const $ModuleId: '<ModuleId>'

The ID of the Module the code belongs to.

Type: the Module ID as a string literal type · Availability: Everywhere

type <DataTypeName> = <declaration>

A Data Type is a TypeScript type with the declaration you wrote, for example a union of allowed values. Use it in type positions, such as let size: This.ShirtSize. It has no value at runtime, so it can’t be called or read.

Availability: Everywhere

  • Language: a Language has no members in code. To read or change the current language, use Sys.Language. To read a Label in one language, use This.$T_<LanguageId> (see Label).
  • Theme: a Theme has no members in code.
  • Access Control: Lowgile compiles an Access Control into server-side rules that it runs itself when it checks access. Code can’t call them. See Access Control.
  • Configuration Items
  • Roles
  • Permissions
  • Data Types
  • Sys.User
  • Language
  • Theme