› Dynamics NAV › Procedure to create custom No. Series in Dynamics NAV

Procedure to create custom No. Series in Dynamics NAV

 Tina Menezes   Leave a comment

Introduction:

No. Series is used to create records in Dynamics NAV with unique numbers. Unique numbers are assigned to data records automatically using No. Series. The format to be used for the No. Series should be set up initially once which consists of a combination of numbers and alphabets.

Pre-Requisite:

Microsoft Dynamics NAV

Purpose:

In this article, I will be demonstrating the procedure to create a custom No. Series in a custom table.

Procedure:

  1. Create a new field in Table 311 – Sales & Receivables Setup which will save the No. Series selected.

    Navigate to the properties of this field and in TableRelation property select Table 308 which is ‘No. Series’.

    Add the newly created field ‘CF_CreditNoteEntity’ to the Page 459 – Sales & Receivables Setup so that it is accessible to the user from the NAV windows or web client.

  2. Now create a new field ‘No. Series’ in a custom table with Data Type ‘Code’.

    Navigate to the properties of the No. Series field and in TableRelation property select Table 308 which is ‘No. Series’.

    Note: ‘No.’ field is the primary key of the custom table which will save the unique No. Series.

  3. Create two new variables in C/AL globals in the custom table.
    a. SalesSetup of DataType ‘Record’ and Subtype ‘Sales & Receivables Setup’ which is Table 311.
    b. NoSeriesMgt of DataType ‘Codeunit’ and Subtype ‘NoSeriesManagement’ which is Codeunit 396.
  4. In OnInsert() trigger of the table add the following code:
  5. In OnValidate() trigger of the primary key field which will save the unique No. Series add the following code. In this scenario, I have added it to the OnValidate() trigger of ‘No.’
  6. Go to ‘No. Series’ which is Table 308 and create a new entry for the No. Series to be used.

    To generate ‘No. Series’ automatically you need to select ‘Default Nos.’ checkbox. If you also want the field to support manual nos. then you should select the checkbox ‘Manual Nos’.

    The ‘Last No. Used’ field gets updated automatically when a record is created and the unique No. Series is inserted in the table.

  7. Navigate to Sales & Receivables Setup which is Page 459 and select the No. Series for the newly created field in step 1 from the drop down list.                                                                                                                  
  8. Hence, automatically when you create a new record, the No. Series will get inserted and a unique record will be created.

Conclusion:

Thus following this procedure, a custom ‘No. Series’ can be created for a custom table with any combination of alphabets and numbers which will create unique records.


Liked it? Share it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.