Get the last inserted record from table using x++
In Microsoft Dynamics 365 for Finance and Operations and Microsoft Dynamics AX 2012, if you want to get the last inserted record form table using X++. You need to order the records as descending by RecId.
RecId is the unique value stored with every row in every table in Microsoft Dynamics 365 for Finance and Operations and Microsoft Dynamics AX 2012 and often known as RecId. So, if we use the ORDER BY clause and use DESC keyword, it will sort the table in descending order by field you use. So, in this case we will use RecId field because it is unique and incremental in nature.
I have shared the code on my GitHub repository. Please download the code to get the last inserted record from table using X++ and use it as per your requirement.
Blog: Click here
YouTube: Click here
GitHub: Click here
Big dreams have small beginnings.
Pingback:Get the last inserted record from table using x++ - Finance and Operations Community
Pingback:What is RecId in Microsoft Dynamics AX/365FO - Microsoft Dynamics AX Community
Pingback:What is RecId in Microsoft Dynamics AX/365FO - Finance and Operations Community
Pingback:What is RecId in Microsoft Dynamics AX/365FO | NevoiTech Blog