Dynamics 365 Business Central: How to get table ID and table name of the opening page via AL

Dynamics 365 Business Central

Hi, Readers.
Last year we had a discussion on how to get the opening Page ID and Page name via AL.

And recently I saw a question, is there any way to get the Table ID and Table name of the opening page via AL?

So in this post, I would like to share a simple way to do this, hope it helps.

First, as you might know, it’s not very difficult to get the Table Name and Table Caption. We can simply use the following method.

Record.TableName() Method: Gets the name of a table.

Record.TableCaption() Method: Gets the current caption of a table as a string.

The problem is the Table ID. But It’s actually not that hard.

We can just use RecordId.TableNo() Method. This method was mentioned when we discussed how to quickly get the primary key values of the record.

RecordId.TableNo() Method: Gets the table number of the table that is identified by RecordID. This function returns an error if the record is blank.

Okay, let’s try it.
Sample Code:

For example,
Customer List:

Vendor Card:

Customer Templates:

Isn’t it very easy? Give it a try!!!😁

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL