How to Set Default Value For Text Field in Salesforce

In this Salesforce tutorial, we will learn how to set the default value for the text field in Salesforce. The default value for the text field uses the default value property which automatically occupies the text field when a new record is created by the user or organization.

To set the default value for the text field using the formula. We need to build a formula that produces the desired default text value. The formula that we enter in the default value formula field can be as simple or complex as our requirement.

Let us take a simple example of a formula to set a default text value. Here we want to set the default value for the description text field to New Record for the custom object called account and we can create the default value formula as “New Record”.

When we click on the account object and create a new record by clicking on the new button the new record is created and we open the record under the detail section we can see the description value is set by default as New Record.

If you want to learn the process of how to set the default value for the text field in Salesforce you have come to the right place and we learn this topic in both the editions of Salesforce Lightning and Salesforce Classic.

How to set the default value for the text field in Salesforce Lightning

Here we will learn how to set the default value for the text field in Salesforce Lightning. Let’s take an example related to Lead Source default value that understands the scenario clearly.

Suppose we are working in the company and I am managing the Sales team of the company and I am using Salesforce which is helpful in tracking the leads. We created the text field lead source detail where the sales representative can add additional information about how they receive the leads.

Here we frequently find that most of the leads come from the same source. For this, we want to save our type so we generate an automatically occupied field with a default value. In the company, where I am working they run an online webinar, and many of the leads come from these webinars. So for this, we set the default value for the lead source detail fields to “Webinar” whenever the new lead is created.

If you want to learn how to set the default value for the text field in Salesforce Lightning, follow these steps:

Step-1: Firstly login to the Salesforce account, the Salesforce Lightning account is open. In this Salesforce Lightning org, we set the default value for the text field.

For this, We can click on the gear icon that is present at the top right corner, and under this gear icon, there are two options. The first one is Setup and the other one is service setup. Click on the Setup option, after clicking on the Setup option.

How to set the default value for the text field in Salesforce

Step-2: After clicking on the setup option the setup page is open, Under this Setup page we can see that the two tabs are present on the nav bar.

The First tab is a Home tab and the other tab is the Object Manager tab, under the object manager tab lots of objects are present. So, Click on the Object Manager tab.

How to set the default value for the text field in Salesforce Lightning

Step-3: After clicking on the Object Manager tab, The Object Manager page opens. Under this object manager tab, lots of objects are present.

Select one of the objects from the lots of objects If the object is not shown you want to choose to enter the object name in the search box and this search box is present at the top right corner of the page.

And here we are entering the Lead in the search box. The Lead object is already present at the first number, if the object is not present at the top after searching the object comes at the top we search in the search box, and select the Lead object from the object manager page.

Set the default value for the text field in Salesforce

Step-4: The Lead object page is open, After clicking on the Lead object, under this page, we can see the details related to the object. And on the left side of the Lead object page, we can see the Fields and Relationships option. Click on the Fields and Relationship option.

Set the default value for the text field in Salesforce Lightning

Step-5: After clicking on the Fields and Relationships option, the Fields and Relationships page is open. Under this page, we can see that lots of fields are already created. But we want to create a new field, so we click on the new button.

Salesforce set the default value for the text field

Step-6: After clicking on the new button,  the data type page opens. There are lots of data types present on the page. Here we are selecting the text data type field that is present at the bottom of the page. The text field type allows the users to enter any combination of letters and numbers and then click on the next button.

Salesforce Lightning set the default value for the text field

Step-7: After clicking on the next button, the Lead new custom field page is open. Now enter the details, first fill the field label as Lead Source Details and then fill the length as 18 after that fill the field length and then fill the field name by simply clicking on the field, and the field name is automatically filled then fill the description if you want to fill otherwise leave the field the same.

How to set default value for the text field in Salesforce

Step-8: Now scroll to the bottom of the page after entering the information related to the lead object. Here we can see that there is a default value field where we can enter the formula that produces the desired default text value for the custom object called lead and we can create the default value formula as “Webinar”.

The formula that we enter in the default value formula field can be as simple or complex as our requirement. After entering the Default value click on the next button.

How to set default value for the text field in Salesforce Lightning

Step-9: The next step is to establish field-level security, After clicking on the next button. Here we select the profile to which we want to grant edit access to this field via field-level security. The field will be hidden from all the profiles if we do not add it to field-level security.

Here we want to select all the field-level security for the profile so we click on the visible checkbox and all the checkboxes are checked and then click on the next button.

Set default value for the text field in Salesforce

Step-10: Here the new custom field was added to the page layouts, After checking the field-level security. Here select the page layouts that should include their fields. The field will be added as the last field in the first two-column section of these page layouts. The field will not appear on any pages if we do not select a layout.

To change the location of this field on the page, we will need to customize the page layout.

When we finish, click on the save and new button to create more custom fields, or click on the save button if we are done.

Set default value for the text field in Salesforce Lightning

Step-11: After clicking on the save button, the lead field and relationships page is open. Under this page, lots of fields are already created and the field we created which is lead source detail with a default value is also present inside this fields and relationships page.

Salesforce set default value for the text field

Step-12: Now go to the App Launcher, click on the app launcher, and enter the sales in the search box. The sales come at the top, click on the sales option. After clicking on the Sales, the Sales page is open. Under this Sales page, there are lots of objects present on the nav bar and we are selecting one of the objects. Here we are selecting the leads object.

After clicking on the lead object, the lead page is opened. Under this page, the record is saved. Here we want to create a new lead, To create the new lead record click on the new button that is present in the right top corner. After clicking on the new button, the new lead dialogue box is open. Here we can fill the information related to the lead.

First, fill the Salutation and then fill the first name and after that fill the last name and then click on the save button.

Salesforce Lightning set default value for the text field

Step-13: After clicking on the save button, Mr. John Willms lead record is created successfully. After opening the John Willims lead record. The record page is open and under this page, we can see that under the lead source details field webinar value is filled by default and shown under the lead source details field.

How to set a default value for the text field in Salesforce

In this way, we understand how to set the default value for the text field in Salesforce Lightning. Let’s Proceed further and learn how to set the default value for the text field in Salesforce Classic.

How to set the default value for the text field in Salesforce Classic

Here we will learn how to set the default value for the text field in Salesforce Classic. Let’s take an example to easily understand the scenario, Suppose I am the manager of the company that uses Salesforce and I manage the Salesforce database of this company that works for different countries.

We want to trace the selected language of our contacts to customize communication successfully. To make sure that data consistency we decided to set the value for the preferred language as a text field. Our organization interacts with customers worldwide. We have noted that a remarkable portion of our contacts favor communication in English.

Here we want to set the default value for the preferred language as English because the contact has the favorite language as English. When we create a new record for contact our default value for the preferred language field to English, as this is the most common preference language.

If you want to learn how to set the default value for the text field in Salesforce Classic follow these steps:

Step-1: When we log into the Salesforce account, we log into the Salesforce Lightning account but we want to work into the Salesforce Classic account for this we want to move to Salesforce Classic.

To switch to Salesforce Classic click on the profile picture, The Profile picture drop-down menu is open, under this drop-down menu, there is an option to switch to the Salesforce Classic edition. Click on the switch to the Salesforce Classic edition. Our Salesforce Classic org is open.

Here we can see that the username is present. Click on the drop-down arrow of the username. After clicking on the drop-down arrow the drop-down list is open. Under this drop-down list, we can see that the Setup option is present. Select the Setup option.

How to set the default value for the text field in Salesforce Classic

Step-2: After clicking on the setup option, the setup page is open. Enter the contacts object in the Quick Find Box. The contacts object comes at the top, click on the drop-down arrow of the contact object. Under this drop-down list, there are field options. Click on the Fields.

Set the default value for the text field in Salesforce Classic

Step-3: After clicking on the contact object, the contact page is open. Now scroll to the bottom of the contact page, There are fields and relationship options present click on this field and relationship option.

After clicking on the field and relation option, the field and relationship page is open. To create the new text field and set the default value for the field, click on the new option that is present at the top of the contact custom fields and relationship section.

Salesforce classic set the default value for the text field

Step-4: After clicking on the new button, the data type page is open. There are lots of data types present. Select one of the data types, we select the text data type which allows users to enter any combination of letters and numbers.

After clicking on the text data type, scroll to the bottom of the page and select the next option.

How to set default value for the text field in Salesforce Classic

Step-5: The contact new custom field page is open, After clicking on the next button. Now enter the details, first fill the field contact as Preferred Language and then fill the length as 25 after that fill the field length and then fill the field name by simply clicking on the field, and the field name is automatically filled Then fill the description if you want to fill otherwise leave the field the same.

Set default value for the text field in Salesforce Classic

Step-6:

  • Now scroll to the bottom of the page after entering the information related to the Preferred Language field.
  • Here we can see that there is a default value field where we can enter the formula that produces the desired default text value for the custom object called contact and we can create the default value as “English”.
  • The formula that we enter in the default value formula field can be as simple or complex as our requirement. After entering the Default value click on the next button.
Salesforce Classic set default value for the text field

Step-7: The next step is to establish field-level security, After clicking on the next button. Here we select the profile to which we want to grant edit access to this field via field-level security. The field will be hidden from all the profiles if we do not add it to field-level security.

Here we want to select all the field-level security for the profile so we click on the visible checkbox and all the checkboxes are checked and then click on the next button.

How to set a default value for the text field in Salesforce Classic

Step-8:

  • After checking the field-level security, the new custom field was added to the page layouts. Here select the page layouts that should include their fields. The field will be added as the last field in the first two-column section of these page layouts.
  • The field will not appear on any pages if we do not select a layout. To change the location of this field on the page, we will need to customize the page layout.
  • When we finish, click on the save and new button to create more custom fields, or click on the save button if we are done.
Set a default value for the text field in Salesforce Classic

Step-9: After clicking on the save button, we come back to our contact fields and relationships page is open. Under this page, lots of fields are already created and the field we created which is the Preferred Language text field type with a default value is also present inside this fields and relationships page.

Now click on the home tab and select the contact object that is present at the nav bar. The contact page is open and under this contact page, there is a new button from which we can create a new record for contact. So click on the new button. The new contact page is open, now fill the complete information related to the contact.

First, fill the Salutation and then fill the first name and after that fill the last name, and then fill the account name. After that fill the lead source as web and we can see that the preferred language field is automatically field as English because of the default value we already set to English after filling the complete information we click on the save button that is present in the middle of the page.

Salesforce Classic set a default value for the text field

Step-10: After saving the complete information related to the contact. Our record is successfully created now click on the Mrs. Liza Batz record and we can see that under this record the preferred language filed is by default filled.

How to set an default value for the text field in Salesforce Classic

So with this, we understand how to set the default value of the text field in Salesforce Classic.

Conclusion:

In this whole blog, we have learned how to set the default value of the text field in Salesforce, we simply choose the object and select the text field that is present under the object, We set the default value for the field for this we scroll down the bottom of the field information page and enter the default value inside the field and click on the save button. And our default value is shown when we create a new record.

I hope you read the complete article and get the complete idea related to how to set the default value of the text field in Salesforce.  I have also explained all the steps of setting the default value of the text field in Salesforce Lightning and Salesforce Classic.

You may like to read