How to Create Auto Number Field Type in Salesforce

When we want to create any sequential numbering and also want to be unique for the records that we will create, then in Salesforce, we have a special data type called auto number. After creating the auto number field, we do need to enter a value for this field manually. This is a read-only field that automatically populates after saving the record.

In this Salesforce tutorial, we will learn about the Auto Number Field Type in Salesforce. In that, I will explain what the auto number field is, its format, and how to create an auto number field type in Salesforce.

Auto number field type in Salesforce

The auto number field type is a field that uses a system-generated sequence number to show the format you define. After using the auto number, it is automatically incremented for every new record.

It can be helpful when the users want the records to enter a unique number every time a new record is created or records need to be tracked by the number.

For example, many contacts are present, and a different record is created every time. An automatically generated unique reference number can be applied to that particular contact, which is helpful for keeping track. Also, if you are integrating another system, it helps in integration as well.

Now, let’s move further and see how to create the auto number field type in Salesforce Lightning and Salesforce Classic.

Read How to Reset or Restart the Auto Number field in Salesforce

How to create an auto number field type in Salesforce

In the following steps, I have explained how to create an auto number field and show you how it works in Salesforce.

1. Click on the gear icon –> Select the Setup option –> Click on the Object Manager tab.

How to create an auto number field type in Salesforce

2. Now, enter the opportunity object in the search box and click the opportunity object, which is the standard object. You can select any standard or custom object that fits your requirements.

How to create an auto number field type in Salesforce Lightning

3. Here, select the Fields and Relationships that are present under the details sidebar.

Create an auto number field type in Salesforce

4. Here, we can see lots of fields are already created, but we want to create a new field. Click on the New button.

Create an auto number field type in Salesforce Lightning

5. Here, we are selecting the Auto Number data type, a system-generated sequence number that uses a display format we define. The number automatically increases for each new record. Click on the next button.

Salesforce create an auto number field type

6. Now enter the details; fill in the field label as Opportunity Number. After that, fill the display format as Opp-{0000}, and then fill the starting number as 1. Now check the checkbox to generate an auto number for existing records, and after that, fill in the field name. Click on the next button.

Salesforce Lightning create an auto number field type

7. Now, establish the field-level security. Select the profiles we want to grant edit access to this field via field-level security. Click on the visible checkbox of the field-level security for the profile and then click on the next button.

How to create auto number field type in Salesforce

8. Select the page layouts that should include this field. The field will be added as the last field in the field two-column section of these page layouts. Click on the save button.

How to create auto number field type in Salesforce Lightning

9. Now click on the App Launcher and enter sales in the search box. The sales page will open. Under this sales page, the nav bar will contain many objects.

Select one of the objects. Here, we are selecting the opportunity object. The opportunity page is open. Under this opportunity page, there are many records.

Here, we are selecting the card item detail record. Under this record, we can see that the opportunity number field is created, and the number is automatically generated.

Create Auto Number Field Type in Salesforce

This way, we understand how to create the auto number field type in Salesforce Lightning. Let’s Proceed and learn how to create the auto number field type in Salesforce Classic.

Read How to Change the Format of Auto Number Field on Existing Record in Salesforce

How to create an auto number field type in Salesforce Classic

Here we are creating the auto number field type in Salesforce Classic.

Now, take an example in which we take a contact object, and there are lots of contacts present. Every time a different record is created, an automatically generated unique reference number can be applied to that particular contact, which is helpful for keeping track. It also helps if you are integrating another system.

Here are the following steps:

1. Login into the Salesforce Account –> Click on the Profile Picture –> Select the Switch to Salesforce Classic option –> Click on the username drop-down arrow –> Select the Setup option.

How to create an auto number field type in Salesforce Classic

2. Now, enter the contact in the search box and click on the contact drop-down arrow. The drop-down list list is open and select the fields option.

Create an auto number field type in Salesforce Classic

3. Now scroll to the bottom of the expense page; there is the Custom Fields and Relationships section. There are lots of fields that are already created, and we want to create a new field. Click on the new button.

Salesforce Classic create an auto number field type

4. The data type page is open. Here, we select the Auto Number data type and click on the next button.

How to create auto number field type in Salesforce Classic

5. Now enter the details. Fill the field label as Unique ID. After that, fill in the display format as UNQ-{0000} and then fill the starting number as 1. Now, check the checkbox to generate an auto number for existing records, and after that, fill in the field name. Click on the next.

Create auto number field type in Salesforce Classic

6. Now, establish the field-level security. Select the profiles to which we want to grant edit access to this field via field-level security. If we do not add field-level security, the field will be hidden from all profiles. Click on the next button.

Salesforce Classic create auto number field type

7. After adding the profile’s field-level security, we can add it to the page layout. Select the layouts that should include this field. We will need to customize the page layout to change the location of this field on the page. Then, click on the save button.

How to create a auto number field type in Salesforce Classic

8. Here, we want to see whether the auto number is generated; we click on the contact object. The contract record page is open; under this, there are lots of records present; here, we click on the Dr. Rosalyn Jaskolski contact.

This contact page shows that the unique id is automatically generated and present under the contact detail.

Create a auto number field type in Salesforce Classic

So, with this, we have learned how to create the auto number field type in Salesforce Classic.

Conclusion

I hope you read the entire article and get a clear idea of how to create an auto number field in Salesforce.

I have also explained all the steps for creating an auto number field in Salesforce Lightning and Salesforce Classic.

You may also like:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.