Create Auto Number Field In Dynamics CRM

Introduction

In Dynamics / Power Platform at times we need to automatically generate an auto number for an entity that has alphanumeric characters. Microsoft offers a custom format auto number option as well. In this example let us see for the contact entity how this can be achieved to generate automatic Id creation for a contact record.

Step 1

Login to the required environment and go to the required solution where you need to do customizations as shown below in figure,

Create Auto Number Field in Dynamics CRM

Step 2

After step 1, select solution and navigate to contact entity and then click on add column and provide Display name as Tag Id and Name as tagid and under datatype select Autonumber type as shown in the below figure.

Create Auto Number Field in Dynamics CRM

Step 3

After step 2, we can provide Autonumber type as String prefixed number or Date prefixed number or Custom so in this example I have selected String prefixed number and provided.

Prefix - ID
Minimum number of digits – 6
Seed Value – 100000

And click on the Done and Save the table as shown in the below figure,

Create Auto Number Field in Dynamics CRM

Step 4

After step 3, search for the field Tag Id and you should see it in the list of created columns as shown in the below figure,

Create Auto Number Field in Dynamics CRM

Step 5

After step 4, add created Tag Id column in the Contact Entity Main Form by navigating to the Contact Entity Main Form and place the Tag Id column inside and make it read-only and click on Save and Publish.

Create Auto Number Field in Dynamics CRM

Step 6

After step 5, Go back to the solution and publish all customizations as shown in the below figure.

Create Auto Number Field in Dynamics CRM

Step 7

After step 6, Go to the Contact entity(table) and create a new contact record and observe that the Tag Id column is automatically populated as shown in the below figure.

Create Auto Number Field in Dynamics CRM

Note

  1. Make sure auto-number data type is selected.
  2. Specify format as per the business requirement.
  3. Publish All Customizations without fail as specified in Step 6.

Conclusion

In this way, one can easily use auto-number data type for a given field in Dynamics CRM