Codeunit 700 Page Management is a Codeunit that I use once in a while. It has functions to get the Default Lookup Page or the Card Page of a certain table.
It also contains functions to open a Page by only passing a Table ID or a Record. You can run it default or modal and even open a page with an autofocus on a certain table field if you like.
All these functions are very handy, but I only miss one.
In my solution I need to get the table of a certain Page ID. So the opposite way of the existing functions.
By looking to the existing functions you will see that there’s a way. Most of the functions are using a system table called “Table Metadata”, were you can easy find the “Lookup Page”.
But the function “GetDefaultCardPageID” also uses the table “Page Metadata”.
So lets take a closer look to this table.
If you compare it to the properties of a page, you will see that most of the properties are in these table.
So we have a field called “Source Table” that we can use to find the Table No. with the following code.
Some things can be easier than you think. Isn’t it?