How to get Next RecId through X++

How to get Next RecId through X++

MCP · Azure DevOpsYour delivery board, readable by an agentMCP · DataverseOne consent, and the data layer opensMCP · Dynamics 365 F&OConnecting F&O to an agent Microsoft hasn’t documented
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));
}


Previous article← Lifecycle issue search directly from AX 2012 R3
Discussion

Ask a question or leave feedback

This is a review interaction. The WordPress version will store, thread and moderate comments.

Thanks — submitted for moderation in this review.
Search the whole site · Ctrl/⌘ + K