Dataverse Primary Name Column Autonumber

Do you ever know how to create and use an Autonumber field in the Dataverse table? Do not pause. This Microsoft Dataverse Tutorial explains everything related to the Dataverse Autonumber field.

Also, we will see how we can use the Primary name column as the Autonumber column in the Dataverse table. Moreover, below are some more topics that we will cover:

  • How we can add the auto number column in Dataverse form?
  • How to convert the Dataverse Primary name column to the Autonumber column?
  • How does it behave when the Dataverse Primary Column Autonumber is a mandatory field?
  • Change the Dataverse Text field to an Auto number field
  • Change the Dataverse Autonumber field to a Text field
  • What is the maximum seed value of a Dataverse Auto number field?
  • What additional uses can we make of the dataverse autonumber fields?
  • What is the maximum and minimum length of the RANDSTRING placeholder?
  • What happens if the Seed value exceeds the required number of digits?
  • Can the format of the present auto number field be changed in the Dataverse Table?
  • Can there be duplicate values in the Dataverse auto number field?

Microsoft Dataverse Autonumber

Microsoft Dataverse Autonumber helps to increase the number in the field instantly and changes the data in the field to a predetermined format.

In Power Apps, Dataverse provides a column called Autonumber that increases the field number automatically in the Dataverse table. Let’s explore how to carry this through.

NOTE:

If you are new to Microsoft Dataverse and want to create the dataverse custom table with various columns, then refer to this complete tutorial: Dataverse Create Table [With Examples]

Create an Autonumber Column in Microsoft Dataverse

Here, first, we will see how we can create an Auto number field and it’s all properties in the Dataverse Table.

  • Sign in to the Power Apps and choose the Power Apps environment you want.
  • Expand the Dataverse (from the left navigation) -> Select Tables -> Select the specific dataverse table (either custom or standard) (ex- Product Sales) as shown below.
Microsoft Dataverse Autonumber
Microsoft Dataverse Autonumber
  • To create the auto number field in the dataverse table, Click on + New -> Select Column. Also, we can use the Columns option under the Schema category.
Dataverse Autonumber field
Dataverse Autonumber field
  • Once we click on the Create button, the New column pane will open on the right side of the page. Now, we need to specify all the below field values:
  1. Display name = This is a required column. Enter the name of the auto number column (suppose Product ID) that you want to create in the Dataverse table.
  2. Description = This is an optional field. Specify the field’s purpose in order to create it.
  3. Data type = Expand the chevron and choose the appropriate data type as Autonumber.
  4. Required = Select if you want it for your business as Recommended, Required, or Optional.
  5. Searchable = This field must be included if you want this field to be searchable. This field is initially checked by default.
Create an Autonumber Column in Microsoft Dataverse
Create an Autonumber Column in Microsoft Dataverse

6. Autonumber type = There are three types of auto number types. Such as:

  • String prefixed number: It specifies that the prefix must begin with a string.
  • Date prefixed number: It specifies that the prefix must begin with a date.
  • Custom: It specifies that the prefix must begin with your own Custom format.
Create Autonumber Column in Dataverse table
Create Autonumber Column in Dataverse table

Let’s explore how each of these three auto-number types performs.

A. String prefixed number:

When we select the Autonumber type as a String prefixed number, then these below fields will appear under that field:

  1. Prefix = Specify the string prefix that you want to display in the auto-generated number. Let’s say “ProdID –“. That means every time the auto number will start with the specified string prefix only.
  2. Minimum number of digits = This is a required column where we need to specify the minimum number of digits that we want to display. Here, the default digit is 4. You can change it as per your need.
  3. Seed value = To specify where the auto number will begin, we must provide a seed value. Here, 1000 will be the default Seed value. Additionally, you may modify the seed value to meet your needs.
  4. Preview = This field is just used for viewing purposes to see how the auto number appears. In the below screenshot, you can see ProdID — 1000, ProdID — 1001, and so on.

Once you expand the Advanced options, these below fields will appear:

  1. Shema name = it is a column that is pre-populated with data from the display name. It contains the customization prefix for the Dataverse solution publisher. You won’t be able to edit the table once you’ve saved it.
  2. Maximum character count = The length must not exceed a number between 1 and 4000. Here, the maximum character count is 100 by default.
  3. Input method editor (IME) mode = Active, Auto, Disabled, and Inactive are the four IME modes. It will only be in Auto mode by default.
Dataverse create autonumber column
Dataverse create autonumber column

Once everything is done, just click on the Save button to create the string prefixed number.

B. Date prefixed number:

When we select the Autonumber type as a Date prefixed number, then the fields listed below will show up under that field:

  1. Date format = Select any of the date format prefixes that you want to display in the auto-generated number. Let’s say “2022-17-08“. This indicates that the auto number will always begin with the prefix of the selected date format only.

When you expand the Date Format field, a variety of formats are displayed, and you must select one of them based on your needs. Refer to the image below.

Autonumber field in Dataverse
Autonumber field in Dataverse

2. Minimum number of digits = We must provide the minimum number of digits we wish to display in this mandatory column. The default digit, in this case, is 4. It may be modified to suit our needs. Like, I have modified it to 3.

3. Seed value = We must supply a seed value in order to designate the starting point for the auto number. The default Seed value, in this case, will be 1000. You may also change the seed value to suit your needs where I have changed it to 100.

4. Preview = Just for viewing purposes, this field is used to see how the auto number occurs. As in the below screenshot, you can see the Preview field displays like 2022-17-08-100, 2022-18-08-101, and so on.

Create Autonumber field in Dataverse table
Create Autonumber field in Dataverse table

The same fields above (in String prefixed number) are available after you access the Advanced settings. Once everything is completed, do not forget to tap on the Save button to create the date prefixed number.

C. Custom:

When we select the Autonumber type as a Custom, then the fields listed below will show up under that field:

  1. Format = Here, we need to define our own format. There are certain auto number options that you can refer to this MSDN link: AutoNumberFormat options. Also, you can append the custom format if you want. There are three types of Append options. Such as:
    1. Add sequential number to format
    2. Add datetime to format
    3. Add random string to format
  2. Seed value = We must define a seed value in order to designate the starting point for the auto number. The default Seed value, in this case, will be 1000. You can change the seed value to suit your needs and I have changed it to 1001.
  3. Preview = This field is just used for viewing reasons to observe how the auto number is generated. As in the below screenshot, you can see preview fields like CNR-NFTQ-1001, CNR-QJS5-1002, and so on.

Here also, you will get all the same fields under the Advanced options. Once everything is finished, click on the Save button.

Autonumber column in Dataverse table
Autonumber column in Dataverse table

This is how to create an autonumber field in the Microsoft Dataverse table.

Also Read: Delete All Records From Dataverse Table [With Examples]

Use the Auto number column in Dataverse Form

Next, we will see how to use this auto number field in the dataverse table form.

In the Dataverse table, when you will open the Columns option under the Schema section, you can view all types of various created and inbuilt fields including the Auto number field i.e. Product ID. Refer to the below screenshot.

Use the Auto number column in Dataverse Form
Use the Auto number column in Dataverse Form

Now, we will add this auto number field in the Dataverse table form. Therefore, this auto number field will create the ID value automatically when the user adds a new item using the dataverse table form. Let’s see how it works.

  • Go to a specific Dataverse table (Product Sales) -> Click on the Forms under the Data experiences section.
Auto number column in Dataverse Form
Auto number column in Dataverse Form
  • After that, the Forms page will show up, displaying three different forms: Quick View, Card, and Main form. As indicated below, choose the Information Main Form.
How to use Auto number field in Dataverse table Form
How to use Auto number field in Dataverse table Form
  • In the Main form, Click on the Table columns from the left navigation. You can view the created auto number field (Product ID) in the column section.
  • Then, decide where in the form you want to add the auto number field and drag it into the General section. Once everything is done, click on Save and Publish button.
add autonumber field to dataverse table form
add autonumber field to dataverse table form
  • Next, go to the Product Sales table -> Click on Edit button -> Expand + New row (on top bar) -> Select + New row using form from dropdown menu.
use auto number in dataverse form
use auto number in dataverse form
  • The form below will now show up, and all fields must have values entered, with the exception of the Autonumber field, which is the Product ID. In the Product ID column, as I have chosen the Required field as an Optional, that’s why the Product ID field is optional to me. Because this field value will autogenerate.
  • Enter the Product Name, Customer Name, Customer Location, Quantity, and Sales. Then click on the Save button. After the item’s saving, the Product ID value will automatically create as ProdID — 1000 as shown below.
Add auto number in dataverse form
Add auto number in dataverse form
  • Now Save and Close the form and go to the Product Sales table. The new item has been created in the table as in the below image.
How to add auto number field in dataverse table form
How to add auto number field in dataverse table form
  • Similar to this, the Product ID value will automatically rise when you add a second item using the dataverse form, becoming ProdID — 1001, and so on.
add auto number field in dataverse table form
add auto number field in dataverse table form

This is how to add the Auto number column in the Dataverse table Form.

Check out: Power Apps Sort Function [With 19 useful examples]

Dataverse Primary Name Column Autonumber

In this topic, we will see how we can convert the Dataverse Primary Name Column to an Autonumber Column.

  • Many of us may wonder if the Primary Name column in the Dataverse Table can be changed to an auto number field. It is possible to change the Dataverse Primary Name field into an AutoNumber field, hence the answer is Yes.
  • But there are certain things that we can not change in the Dataverse Primary Column like Schema name and Logical name.
  • When a column is saved, whatever name you give it for the first time will act as its internal or schema name. Thus the schema name cannot be altered or changed afterward.
  • For example, earlier I defined a Primary Column called Product Name with a Single Line of Text Data type in the Dataverse table (Product Sales). I now want to change this column to a field for auto numbers.
Dataverse Primary Name Column Autonumber
Dataverse Primary Name Column Autonumber
  • The primary column previously represented the following Display name (Product Name), Description, Data type (Single line of text), etc., as seen in the picture below.
Primary Name Column Autonumber in Dataverse
Primary Name Column Autonumber in Dataverse
  • Now to convert the primary field as an autonumber, I modified the below fields:
    • Display name = Specify this value to Product Auto ID.
    • Description = Specify the description as per your need.
    • Data type = Expand the Data type and select Autonumber.
    • Required = Select the Required field to Optional. It will be Business required by default.
primary name column dataverse
primary name column dataverse
  • Next, comes the below fields:
    • Searchable = By default, the searchable option will be enabled.
    • Autonumber type = Select the type of autonumber field like String prefix number.
    • Prefix = Provide the string Prefix.
    • Minimum number of digits = Enter the minimum length digit of the auto number.
    • Seed value = Provide the seed value from where you want to start the autonumber (Eg- 101).
    • Preview = You can view that how the auto number field will look like.
dataverse primary name column unique
dataverse primary name column unique
  • Once you will expand the Advanced options, you can view the Schema name and the Logical name will display with the previous primary column name. As we also discussed, these field values will not change anymore.
  • Also, you can provide the Maximum character count and IME mode as per your need. Finally, click on the Save button.
dataverse primary name autonumber
dataverse primary name autonumber
  • Now, in the Columns section, you will see the dataverse primary field is converted to the Auto number field as shown below.
dataverse primary name field autonumber
dataverse primary name field autonumber
  • Let’s create a new item in the Dataverse table (Product Sales). Open the specific table and then go to the Edit button. Expand the + New row -> New row using form as shown below.
primary name field autonumber in dataverse table
primary name field autonumber in dataverse table
  • Refresh the dataverse table form and enter all the field values except the Primary auto number column i.e. Product Name (in the form, it’s showing the field Schema name instead of the Product Auto ID).
  • When you save the form, you can see the Primary auto number field has been generated with an autonumber that begins with ProdAutoID — 101. Save and Close the app now.
  • Once you go back to the Product Sales table, you will see the new row or new item as in the image below.
Primary Name Column Autonumber Dataverse
Primary Name Column Autonumber Dataverse

This is how to work with Dataverse Primary Name Column Autonumber.

Read: Power Apps Sort Gallery [With 15 Useful Examples]

How does it behave when the Dataverse Primary column Autonumber is a Required Field?

  • Let us say, the Dataverse Primary Column (Product Auto ID) is a mandatory field (Autonumber data type). That means, as per our need, we want to make this field a required field for the user.
  • Then, in that case, we will edit the primary column and choose the Required field option to Business required. Next, how will it act if we make this primary field in the Dataverse table a required field?
when the Dataverse Primary column is a Required Field
when the Dataverse Primary column is a Required Field
  • The Primary column will give an error saying “Product Name: Required fields must be filled in.” at the time of saving a new entry using the Dataverse form. because the main column of this dataverse table is a required field.
  • In this situation, we must still supply the value for the main field in order to prevent the issue. The new entry will only save in the Dataverse table after that.
Dataverse Primary column is a Required Field
Dataverse Primary column is a Required Field
  • As you can see in the below image, I have entered the value as 1 to the Primary column (Product Name) and then click on the Save button. After that, the new entry is saved in the dataverse table (Product Sales) with the user-provided value only.
  • Since it is an Autonumber column, it does not produce any auto numbers like ProdAutoID — 101 in the dataverse table.
dataverse autonumber primary key
dataverse autonumber primary key

This is what happens when the Dataverse Primary column Autonumber is a Required Field.

Also, check out: PowerApps Search Function + How to use with example

Few Important Features of Dataverse Auto Number Field

There are certain key features of the Auto Number field in the Dataverse table. Such as:

1. Can we change the Dataverse text field to an auto-number field that is already there?

Yes, we can change any text field in the Dataverse table to an autonumber field. See this illustration:

autonumber primary key dataverse
autonumber primary key dataverse

NOTE:

Although the auto number field looks a text field, it differs in that it creates a random number when no value is entered.

Check out: Filter Dataverse Choice Column [With Various Examples]

2. Can we change the Dataverse auto number field back to a text field once more?

Yes, we can convert the Auto number field back to the Text field again in the Dataverse table.

Dataverse autonumber primary column
Dataverse autonumber primary column

3. In the Dataverse Auto number field, what is the maximum seed value?

The Dataverse Auto Number field’s maximum seed value must be less than 9007199254740991.

Dataverse Autonumber Primary Field
Dataverse Autonumber Primary Field

Also check: How to Upload images to Dataverse from Power Apps

4. What additional uses can we make of the auto number fields?

To enable manual entry of data, we may make the field in the form read-only. We can also make the field mandatory, and for further uniqueness, we can provide alternate keys.

Dataverse Primary key Autonumber
Dataverse Primary key Autonumber

5. What are the RANDSTRING placeholders’ minimum and maximum lengths?

The minimum length of RANDSTRING placeholders must be greater than 0 and less than 7.

Dataverse Primary Key Auto number
Dataverse Primary Key Auto number

6. What happens if the Seed value exceeds the required number of digits?

The program won’t raise an exception and will instead assign the following value. Refer to the screenshot below.

Primary Autonumber field in Dataverse
Primary Autonumber field in Dataverse

7. Can the format of the present auto number field be changed in the Dataverse Table?

Yes, we can modify the format of the present auto number field in the Dataverse table. In the below screenshot, you can see the Format as {SEQNUM:4}{RANDSTRING:4} and the result is in Preview as 09993H22, 100005V7Q, and so on.

Primary Autonumber field in Dataverse table
Primary Autonumber field in Dataverse table

Check: How to Create Dataverse View

8. Can there be duplicate values in the Dataverse auto number field?

No, the Dataverse Auto number field can not have any duplicate values. It will only allow unique values. If you enter any duplicate value to the autonumber field, an error will occur like “A record that has the attribute values Product ID already exists.” as shown below.

duplicate values in the Dataverse auto number field
duplicate values in the Dataverse auto number field

Also, you may like the below Power Apps Tutorials:

This Microsoft Dataverse tutorial explained what is Microsoft Dataverse Auto number, How to create and use an autonumber column in the dataverse table. Also, we learned some more below topics. Such as:

  • How we can add the auto number column in Dataverse form?
  • How to convert the Dataverse Primary name column to the Autonumber column?
  • How does it behave when the Dataverse Primary Column Autonumber is a mandatory field?
  • Change the Dataverse Text field to an Auto number field
  • Change the Dataverse Autonumber field to a Text field
  • What is the maximum seed value of a Dataverse Auto number field?
  • What additional uses can we make of the dataverse autonumber fields?
  • What is the maximum and minimum length of the RANDSTRING placeholder?
  • What happens if the Seed value exceeds the required number of digits?
  • Can the format of the present auto number field be changed in the Dataverse Table?
  • Can there be duplicate values in the Dataverse auto number field?
>