Wednesday, September 23, 2015

How to get Next RecId through X++

Below piece of code can be used to retrieve next record Id from the table.

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

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

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


No comments:

Post a Comment

I will appreciate your comments !

Download large bacpac (sandbox database) to DEV environment much faster

As the LCS website gets slower and slower and the database backups get bigger and bigger.  Use AZCopy to download objects out of LCS asset l...