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
How to reach it
Section titled “How to reach it”| Business Object type | Access path | Grouped under a $ namespace |
|---|---|---|
| Configuration Item | This.$Config.<ItemName> | Yes. This.<ItemName> does not work. |
| Role | This.$Roles.<RoleName> | Yes. This.<RoleName> does not work. |
| Permission | This.$Permissions.<PermissionName> | Yes. This.<PermissionName> does not work. |
| Data Type | This.<DataTypeName>, as a type only | No. |
| Language, Theme, Access Control | Nothing to reach | — |
This.$ModuleId holds the ID of the Module itself.
Properties
Section titled “Properties”$Config
Section titled “$Config”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.senderAddressEach 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
$Roles
Section titled “$Roles”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-sideif (Sys.User.currentUser?.hasEffectiveRole(This.$Roles.Approver)) { // …}
// client-sideif (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
$Permissions
Section titled “$Permissions”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
$ModuleId
Section titled “$ModuleId”const $ModuleId: '<ModuleId>'The ID of the Module the code belongs to.
Type: the Module ID as a string literal type · Availability: Everywhere
<DataTypeName>
Section titled “<DataTypeName>”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
Business Object types without a code API
Section titled “Business Object types without a code API”- 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.
Related
Section titled “Related”- Configuration Items
- Roles
- Permissions
- Data Types
- Sys.User
- Language
- Theme