Thursday, 12 September 2019

Get the last inserted record from table in Dynamics AX/D365 using x++

Sometimes we get a requirement to get latest inserted record from a table in dynamics AX.
Below is an example code for that. Here, I used order by desc to get the latest record.

select firstfast salesTable order by CreatedDateTime desc where salesTable.CustAccount == custTable.AccountNum
                    && salesTable.SalesType == SalesType::Sales
                    && salesTable.SalesStatus != SalesStatus::Canceled;

@Rahul

No comments:

Post a Comment

Adding a newline into a string in C# and X++

Below is the sample code we can use for  adding a newline after every occurrence of "@" symbol in the string in C#   using System...