Редагувати

Поділитися через


Access Property

Version: Available or changed with runtime version 4.0.

Sets the object accessibility level, which controls whether the object can be used from other code in your module or other modules.

Applies to

  • Codeunit
  • Query
  • Table
  • Table field
  • Enum Type
  • Interface
  • Permission Set

Property value

Value Available or changed with Description
Public runtime version 4.0 The object can be accessed by any other code in the same module and in other modules that references it.
Internal runtime version 4.0 The object can be accessed only by code in the same module, but not from another module.

Table field level

For table fields there are two additional settings for Access and you have the following settings available:

Access modifier Level of accessibility
Local The field can be accessed only by code in the same table or table extension where the field is defined.
Protected The field can be accessed only by code in the same table or table extensions of that table.
Public The object can be accessed by any other code in the same module and in other modules that references it. It is the default value.
Internal The object can be accessed only by code in the same module, but not from another module.

Syntax

Tables

table 50111 MyTable
{
    DataClassification = CustomerContent;
    Access = Internal;
    ...
    

Table fields

table 50111 MyTable
{
    DataClassification = CustomerContent;
        
    fields
    {
        field(1;MyField; Integer)
        {
            DataClassification = CustomerContent;
            Access = Protected;
    ...            

Queries

query 50114 MyQuery
{
    QueryType = Normal;
    Access = Internal;
    ...

Codeunits

codeunit 50113 MyCodeunit
{
    Access = Internal;
    ...

Remarks

Important

This property is only taken into consideration at compile time. For example, at compile time, a table with Access = Internal cannot be used from other modules that do not have access to the internals of the module where the table is defined, but at runtime, any module can access the table by using reflection-based mechanisms such as RecordRef, or TransferFields. And the OnRun trigger can be run on internal codeunits by using Codeunit.Run. Setting the object accessibility level as Access = Internal; cannot be used as a security boundary. Also see JSON Files.

Note

The accessibility of tables and table fields is taken into account when using Designer. As a consequence, only table fields which have their accessibility set to Public can be added to the page.

Properties
Extensible Property
Protected Variables