I worked as an admin for a company that used Salesforce. The sales team wanted an easy way to search Google for information related to their accounts without having to open a new browser tab.
To simplify their task, I decided to add a custom button to the account object that redirects to Google and automatically fills the search bar with the account name.
In this tutorial, I will explain how to create custom buttons in Salesforce. Later, we will explore how to create custom detail pages and list buttons in Salesforce, complete with examples and step-by-step explanations.
Explain Custom Buttons in Salesforce
A custom button in Salesforce is a user-defined button that enhances functionality by allowing users to perform specific actions directly from record detail pages or list views.
These buttons can be configured to redirect to URLs, open Visualforce pages, trigger Lightning components, or execute specific actions such as updating records or launching flows.
The following are the types of buttons in Salesforce:
- Detail Page Button: We can add this button to the detail page of records, where we can view record information, such as account, contacts, or any custom object’s record details.
- List Button: We can add this button to the standard or custom objects’ list views, where we can view all records of a particular object.
- Detail Page Link: This is similar to the detail page button, but it displays as a hyperlink instead of a button. We usually add it to the links section of the record page in the page layout.
Create a Custom Detail Page Button in Salesforce
According to the scenario we discussed above, we will create a custom detail page button in Salesforce that allows users to browse information about the current record directly.
- Go to the Setup. Then, navigate to the “Object Manager” tab. There, you can search for an object on which you want to create a custom detail page button. Here, I selected an account object.
- Go to the Button, Links, and Actions, and click the New Button or Links button.

- Enter the Label as per your requirement. The Name will automatically populate as you click on it. The name is an API Name that we use in flows, VF pages, and apex classes. The description is optional.
- The Display Type decides where you can add this button on the page layout, how it will appear, and what the functionality will be. Here, we are creating a Detail Page Button.
- Then, in Behaviour, we can decide which window/tab to open after the click event happens on this button. Here, we have different options, such as an existing window with or without a sidebar, or a new window. Then, in the Content Source, select the URL option.

- Now, we need to enter the URL so that when we click the button, we are redirected to the entered URL. Here, we want information about our account name. For that, I entered the Google link below with the account name.
- When you click the button, you will be redirected to a new window, and the search bar will automatically fill with the current record’s account name.
https://www.google.com/search?q={!Account.Name}Then, check the syntax and click the Save button.

- Now, you can see that the ‘Search Acc Info‘ button has been successfully created with the display type ‘Detail Page Button.’
- This button will not directly display on the detail page. For that, we need to add it from the page layout.

Add Custom Detail Page Button to Salesforce Lightning
- We need to add this button to the account object’s page layout. To do that, navigate to the object on which you created the custom button and open the page layout where you placed the button on the detail page.
- Now, when we want to add a custom detail page button to the Salesforce Lightning Detail Page, we need to select “Mobile & Lightning Actions” instead of the “Buttons” option. Then, we’ll create a button, and you need to drag and drop it into the Salesforce Mobile and Lightning Experience Actions section.
- Then, save the page layout.

- As you navigate to the account object tab and open any record, you will be on the record detail page for that record. Now, you will see the detail page button that we created. Click on that button.

- When you click on the button, you will be redirected to the Google link, which automatically browses information about the account name from which you click the detail page button.

Add Custom Detail Page Button to Salesforce Classic
- We will see when we add the created button from the Buttons option. When you add the custom button from the buttons option to the Detail section, it will get added to the Salesforce Classic layout.

- I switched to Salesforce Classic and opened an account record. The custom detail page button has been added successfully to the record detail page.

In this way, we can create and add a custom detail page button in the Salesforce Lightning and Salesforce Classic.
Create a Custom List Button in Salesforce
The custom list button appears on list views for objects and allows users to perform actions on one or more selected records. For example, from the Leads object’s list view, when we click the custom button we create, it should redirect us to the Salesforce Help page.
- Navigate to the Create New Button or Link from the object manager. Enter the details, like the Label description. Select display type. Here, we are creating a List Button for selecting the list button option, and with that, we get one checkbox, which allows you to select it when you want to update multiple records.
- Select behavior so that the new window appears when you click the button where you want it to appear. As we want to open the Salesforce help page, here we need to select the URL in Content Source.

- Enter the URL so that when you click the button, you will get redirected to that page. Then, click the Save button. The button that we created does not automatically get added to the list view.

Add Custom List Button in Salesforce
- To add the custom list button to the list view, we need to navigate to the object on which we created the custom list button, click the List View Button Layout, click the drop-down arrow, and select the Edit option.

- Then, in the Custom Buttons section, you will see the button you created in the Available Buttons section. You need to add it to the Selected buttons and then click the Save button.

- As you navigate to the object on which you created the list button and added it to the list view. You will see that the button has been successfully added to the list view. As you click that button, you will be redirected to the page with the URL you provided.

In this way, we can create a new custom list button and add it to the list view in Salesforce.
Conclusion
I hope you have an idea about custom buttons in Salesforce. In this tutorial, I explained what custom buttons are and their uses. Then, I explained how to create a custom detail page button and add it to the detail page in Salesforce.
Then, I explained how to create a new custom list button and add it to Salesforce’s list view with scenarios and step-by-step explanations.
You may like to read:
- New Button Missing on Campaigns in Salesforce
- Merge case button not showing in Salesforce
- Salesforce Lightning Log a Call button missing
- Call a Flow From Button in Salesforce
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.