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 / The Dynamics 365 Library / How to get Next RecId throu...

How to get Next RecId through X++

Faisal Fareed Profile Picture Faisal Fareed 10,796 User Group Leader
Below piece of code can be used to retrieve next record Id from the table.

static voidgetNextRecId(Args _args)
{
    //Table that stores record ids details for tables
    SystemSequences systemSequences;

    //Class that handles Record id generation
    SystemSequence systemSequence = newSystemSequence();
    ;

    info(strFmt("%1", tableNum(SalesTable)));  
   
    systemSequence.suspendRecIds(tableNum(SalesTable));
    info(strFmt("Next record id: %1", systemSequence.reserveValues(1,tableNum(SalesTable))));
    systemSequence.removeRecIdSuspension(tableNum(SalesTable));
}



This was originally posted here.

Comments

*This post is locked for comments