Sunday, April 11, 2021

Auto Generate Number In D365 Table Field

This Post explains to you how to generate a sequence of auto Generated Numbers using X++ code. One way is we can use Number Sequence and another way we can write this logic to generate our auto-updated number.

Let's Go to the code you can write this logic to the InitValue Method of the table to update the value on every creation.

    /// <summary>
    ///
    /// </summary>
    public void initValue()
    {
        TableName          table;
        int                         i;
        super();

        select count(RecId) from table;
        i = table.RecId;
      
        this.FieldName =  (i + 1);   
    }

Enjoy 👍

No comments:

Workflow Approver Name For PurchRequsition Order

 For First Approver, this.workflowApprover(purchReqTable.RecId);     public void workflowApprover (RecId _recId)  // Requsation Table RecId ...