web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / axility.NET / AX7 – Table Id and Field Id

AX7 – Table Id and Field Id

Volker Breitkopf Profile Picture Volker Breitkopf

During development and especially debugging the new Microsoft Dynamics AX you are to face the question which table Id or field Id actually stands for which table. In AX 2012 you saw the Ids in the property sheet of selected AOT elements; those were stored in the model database. With AX7 this has changed.

If you want to know the Id of table CustTable or its field AccountNum you can use X++ and do something like

info(strFmt('%1', tableNum(CustTable)));
info(strFmt('%1', fieldNum(CustTable, AccountNum)));

This hasn’t changed. Some data references those Ids – for example document references (the attachments available throughout the system). If you examine stored data you need to do the other way around and find out about what it references. Still you can do that using X++

info(tableId2Name(10347));
info(fieldId2Name(10347, 1));

But what to do when you aren’t able to execute X++ code or simply don’t want to because you don’t have Visual Studio or there’s a simpler and quicker way? :)
In AX 2012 I usually used the (virtual) table UtilIdElements for that and had a simple list form with that table as datasource. Right now the table still exists but it is empty at any time.
Now there is an even easier solution. The mappings now are stored in the AX database which comes with great advantages! It is one factor enabling you to move database backups between environments. If you didn’t know yet – yes, this is possible now (if you take some things into consideration, of course).

The new tables you can query for table and field names when you only know the Ids are
TABLEIDTABLE
TABLEFIELDIDTABLE

Unfortunately you can’t use the table browser to access them but SQL Server Management Studio will let you do the trick. As an example I present you the T-SQL select statements for CustTable (Id 10347 in my environment) and its field AccountNum (Id 1).

SELECT [ID]
      ,[NAME]
      ,[RECVERSION]
      ,[RECID]
  FROM [AxDBRAIN].[dbo].[TABLEIDTABLE]
  WHERE [ID] = 10347
SELECT [ROOTID]
      ,[TABLEID]
      ,[ID]
      ,[NAME]
      ,[RECVERSION]
      ,[RECID]
  FROM [AxDBRAIN].[dbo].[TABLEFIELDIDTABLE]
  WHERE [TABLEID] = 10347
  AND [ID] = 1

The ROOTID field of the field Id table is used for table inheritance. There are some more tables starting with TABLE and they might help you when you need further information in that area.

TABLEIDTABLE

Comments

*This post is locked for comments