Default Value for URL Field in Salesforce

The default value for the URL field in Salesforce is used to set the default value inside the URL field.

In this Salesforce tutorial, I will explain how to set a default value for URL Field in Salesforce Lightning and Classic Interface.

How to Set Default Value for URL Field in Salesforce Lightning

Here, we will learn how to set the default value for the URL field in Salesforce Lightning.

Suppose there is a company that is based in the United States of America and sells various products and the company uses the salesforce products to manage all the data of the customers.

We have a custom object as a Product inside this Product object, and there is a URL field called Product Website. This product website field is used to store the website links related to products.

So, the company team decided to set the default value for the product website field to a general webpage like our company home page.

Here are the following steps:

1. Log into the Salesforce Account –> Go to Gear Icon –> Click on the Setup –> Select the Setup option.

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

2. Here, enter the product in the search box. Select the product object from the object manager page.

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

3. The product page opens. Under this page, we can see the details related to the product. On the left side, there is a Fields and Relationships option present. Click on this Fields & Relationships option.

See also  Salesforce Formula for Text Field
Set the default value for the URL field in Salesforce

4. Here, you want to select the URL field. We can see that the Product website is a URL field, so click on that field.

Set the default value for the URL field in Salesforce Lightning

5. Here, click on the edit button. The Product website field comes into edit mode. Scroll to the bottom of the page.

There is a general options section, and under this section, there is a default value field. Inside this field, we use formula syntax to enclose text and picklist value API names in double quotes, including numbers without quotes.

We can set the default value as

“https://salesforcefaqs.com/”.
Salesforce Lightning set the default value for the URL field

6. Our custom field definition detail page is open, and we can see that our default value is set and shown under the general options.

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

7. Go to the App Launcher and enter sales in the search box. The sales option will appear at the top. Click on it. Here, we are selecting the product object. The product record page is opened.

If we want to create a new product, click on the new button. The new product dialogue box will open. We can fill in the information related to the product. For example, we can fill in the product name as Salesforce Products. After that, we can see that our Product Website field is, by default, filled. Click on the save button.

How to set a default value for the URL field in Salesforce Lightning

8. Here, we can also see the Salesforce website field. The URL related to the Product is present. We can click on this URL and visit the product website.

Set a default value for the URL field in Salesforce

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

See also  How to Create Date Time Field Type in Salesforce

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

Here, we will learn how to set the default value for the URL field in Salesforce Classic.

Consider a scenario: Suppose there is a software development company that uses Salesforce. I am managing the project details here.

We have a project custom object, and in this object, we can store information related to each project, including the Project Documentation URL. This Project documentation URL is used to link the documentation related to the project.

We can see the default value for the project documentation field, which points to our company documentation portal, to ensure that the projects created by the users are linked with the project documentation.

Here are the following steps:

1. Go to the Profile Picture –> Click on Switch to Salesforce Classic version –> Select the Setup option.

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

2. Enter the Objects in the Quick Find box and click on the drop-down arrow of Create. Click on the object option.

Set the default value for the URL field in Salesforce Classic

3. The custom object page is open here we see the project object and click on this object.

Salesforce Classic set the default value for the URL field

4. Under this project page, we can see that there is a custom field and relationship section under this section. We can see the fields are already created, and there is a Project Documentation URL is a URL field. Click on this Project Documentation URL field.

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

5. Here we edit the Project Documentation URL page. Scroll to the bottom of the page. There is a general options section, and under this section, there is a default value field.

See also  How to Make Text Field Required in Salesforce

Here can set the default value formula as

“https://pythonguides.com/python-and-machine-learning-training-course/”.
Set a default value for the text field in Salesforce Classic

6. Now click on the project object from the nav bar. The project record page is open and here we want to create a new record so for this click on the new button. Here we can see the project documentation URL field is already filled we do not need to fill it out and click on the save button.

Salesforce Classic set a default value for the URL field

7. We can see under the Project documentation URL field the URL related to the Project documentation is present we can click on this URL and visit the Project documentation website.

How to set a default value for a URL field in Salesforce Classic

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

Conclusion:

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

You may like to read: