Dynamics 365 Business Central: Difference between Table Data and Table in Permissions

Dynamics 365 Business Central

Hi, Readers.
Today I would like to briefly talk about a very basic topic, what is the difference between Table Data and Table in Permissions.

I think consultants who have experienced NAV may not be unfamiliar with this question, but for new BC consultants and developers, they may be a bit confused at first, why is there Table Data and Table in the Object Type, and what is the difference between them?

It’s actually not that difficult.

Table Data: The Table Data refers to the data stored in the table.

You can set Read, Insert, Modify, Delete permission for Table Data. But cannot set Execute permission in Permissions page.

Table: Table is the same as other object types such as Report, Codeunit, XMLPort, etc. referring to the Table Object themselves. For example, the definition of the tables, the triggers, functions, and the keys of the table.

So, in contrast to Table Data, you can set Execute permission, but cannot set Read, Insert, Modify, Delete permission for Table.

But if you want users to access data on the UI, you need to set at least add the Execute permission of Page, Table object and the Read permission of Table Data. Otherwise users will not be able to search and open the page.
For example,

PS: LOGIN Permission Set (Minimal permission set for log-in)

Let’s look at some detailed examples.
I created a new list page, Lab Book List (50100, List).

1. If you want users to open page on the UI, you need to add at least the following three permissions.

Test Video: If Table and Table Data are missing one, the page cannot be opened in the UI.

2. If you don’t need to access the data in the table, you just need to execute the function in the table, then you only need to add the Table permission.
For example,
A very simple function:

Call it on the Payment Methods page.

If the user do not have Table permission, the following error will be prompted.

Test Video:

3. If you only need to access the data in the table, you only need to add the Table Data.
For example,

If the user do not have Table Data permissions, the following error will be prompted.

Test Video:

Note:
If the TableType of the table is set to Temporary, you can read, insert, modify and delete data without additionally setting Table Data permission.

And using a temporary record variable is the same as the temporary table above.

Source code of the tested table and page:

table 50100 "Lab Book"
{
    DataClassification = CustomerContent;

    fields
    {
        field(1; "No."; Code[10])
        {
            Caption = 'No.';
            DataClassification = CustomerContent;
        }
        field(2; Title; Text[30])
        {
            Caption = 'Title';
            DataClassification = CustomerContent;
        }
        field(3; Author; Text[30])
        {
            Caption = 'Author';
            DataClassification = CustomerContent;
        }
        field(4; Hardcover; Boolean)
        {
            Caption = 'Hardcover';
            DataClassification = CustomerContent;
        }
        field(5; "Page Count"; Integer)
        {
            Caption = 'Page Count';
            DataClassification = CustomerContent;
        }
    }

    keys
    {
        key(PK; "No.")
        {
            Clustered = true;
        }
    }
}
page 50100 "Lab Book List"
{
    PageType = List;
    UsageCategory = Lists;
    ApplicationArea = All;
    SourceTable = "Lab Book";
    Caption = 'Book List';

    layout
    {
        area(Content)
        {
            repeater(Group)
            {
                field("No."; Rec."No.")
                {
                    ApplicationArea = All;
                }
                field(Title; Rec.Title)
                {
                    ApplicationArea = All;
                }
                field(Author; Rec.Author)
                {
                    ApplicationArea = All;
                }
                field(Hardcover; Rec.Hardcover)
                {
                    ApplicationArea = All;
                }
                field("Page Count"; Rec."Page Count")
                {
                    ApplicationArea = All;
                }

            }
        }
    }
}

END

Hope this will help.

Thanks for reading.

ZHU

コメント

タイトルとURLをコピーしました