Overview

Number sequences are used to generate readable, unique identifiers for master data records and transaction records. These sequences are normally one of the first things set up after a legal entity is deployed. When either implementing or migrating these number sequences between environments you can utilize either the ‘SequenceTables’ or ‘SequenceV2Tables’ data entities to help with this process, but there is one field that requires a slightly unique syntax and can causes issues. Let’s take a look at how to get this process to work.

Number Sequence

Number sequences can be found at Organization Administration -> Number Sequences -> Number Sequences:

Here you can see a listing of all number sequences already created, you can notice in the Format column the number/pound symbol (#). This is because number sequences have a dynamic portion to them, so the # symbol holds the position of the dynamic portion of the number sequence. The number of #’s used indicate the total size of the sequence, so five #’s together show that numbers can go from 00001 – 99999.

Within each number sequence, in the ‘Segments’ section you can see the actual different parts to the number sequence. This field is what makes this slightly unique when trying to create/update this field in the data entity as the syntax to store this data is fairly complex.

If we export the number sequences via data entity, the ‘Format’ column stores the human readable overview of what the number sequence syntax looks like. But the ‘AnnotatedFormat’ column is what stores the number sequence ‘Segments’ data.

If you click into the field, you can see that this unique formatting is actually more complex than it initially looks as there are a combinations of different parameter delimiters mixed with tabs and new lines.

If we look at the SequenceTables entity and filter for this number sequence we can see the JSON returned includes all of the tabs (\t) and new lines (\n) that exist in the Excel file as well:

Creating New Number Sequences via Data Entity

So given the complexities above, what is the best way to mass create custom number sequences?

In my opinion, the easiest way to create these is to manually create an example of each number sequence type you plan on creating and then look at the output from either the Data Management Framework export or from the data entity itself which will give you a template to follow that you can then copy and modify them as needed.

To help with this process, I’ve created a file with a number of different number sequence formats and their associated AnnotatedFormat patterns for reference.

Here is screenshot of the available different formats:

References

Number Sequence Overview

How to Use a D365 Number Sequences