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 Sou