Let's Build Your First Campaign Together with our Lead Generation Expert

How to Add a Custom Button to Page Layout in Salesforce

Table of Contents

Salesforce is powerful. But power comes with complexity.

If you’ve ever tried to add a custom button to a page layout and ended up clicking through five different menus wondering where it disappeared to — you’re not alone. It’s one of those things that feels like it should take 30 seconds but somehow eats up 30 minutes.

This guide walks you through exactly how to create a custom button and add it to a Salesforce page layout — step by step, no fluff.

Whether you’re adding a button that triggers an automation, opens a URL, or runs custom logic, the process is the same. Let’s get into it.

What Is a Custom Button in Salesforce?

A custom button in Salesforce is a clickable element you can add to an object’s page layout to trigger specific actions. These actions typically fall into three types:

  • Detail Page Button — appears in the button bar on a record’s detail page
  • List Button — appears in a list view and can act on multiple records at once
  • Detail Page Link — appears in the links section of a page layout

Custom buttons can execute JavaScript, open URLs, run Apex (via custom links), or trigger flows and workflows. According to Salesforce research, over 72% of Salesforce admins regularly use custom buttons or links to streamline repetitive tasks and reduce clicks for their teams.

Before You Start: What You Need

You don’t need to be a developer to create a custom button. But you do need:

  • System Administrator profile or a profile with “Customize Application” permission
  • Access to Setup in your Salesforce org
  • A clear idea of what the button should do (URL, JavaScript, or Salesforce function)

If you’re on Salesforce Lightning Experience, keep in mind that JavaScript buttons are not supported in Lightning — they only work in Salesforce Classic. For Lightning-compatible custom actions, you’ll want to use Quick Actions or Flow-based buttons instead. More on that below.

How to Create a Custom Button in Salesforce

Step 1: Go to Object Manager

  1. Click the gear icon in the top-right corner of Salesforce
  2. Select Setup
  3. In the Quick Find box, type Object Manager
  4. Click Object Manager and select the object you want to add the button to (e.g., Lead, Contact, Opportunity)

Step 2: Navigate to Buttons, Links, and Actions

Inside your selected object:

  1. In the left sidebar, click Buttons, Links, and Actions
  2. Click New Button or Link in the top-right corner

You’ll now see the button creation form.

Step 3: Configure Your Custom Button

Fill in the following fields:

Label — This is what users will see on the button. Keep it short and action-oriented (e.g., “Send to HubSpot,” “Mark as Reviewed,” “Open Dashboard”).

Name — Auto-fills based on the label. This is the API name used internally.

Description — Optional, but recommended. Helps future admins understand what this button does.

Display Type — Choose from:

  • Detail Page Button — shows on the record detail view
  • Detail Page Link — shows in the custom links section
  • List Button — shows on list views

Behavior — Determines how the target content opens:

  • Display in existing window with sidebar — standard navigation
  • Display in existing window without sidebar — cleaner view
  • Display in new window — opens in a separate tab
  • Execute JavaScript — Classic only; runs JS code inline

Content Source — Select one of:

  • URL — points to an internal or external URL
  • JavaScript — runs JS logic (Classic only)
  • Visualforce Page — loads a Visualforce page within the record context

URL or Content Field — Enter your URL or code depending on the content source selected.

Click Save when done.

How to Add the Custom Button to a Page Layout

Creating the button is only half the job. The button won’t appear on any record until you add it to a page layout.

Step 4: Open the Page Layout Editor

From the same object in Object Manager:

  1. Click Page Layouts in the left sidebar
  2. Click the page layout you want to edit (e.g., “Lead Layout,” “Contact Layout”)
  3. The Page Layout Editor will open

Step 5: Drag the Button onto the Layout

  1. In the palette at the top of the editor, click Buttons
  2. You’ll see your newly created button listed there
  3. Scroll down to the Custom Buttons section in the layout (usually near the top of the record detail area)
  4. Drag and drop your button from the palette into the Custom Buttons section

If you don’t see a Custom Buttons section, look for the button bar area at the top of the page layout — that’s where detail page buttons live.

Step 6: Save the Page Layout

Click Save at the top of the Page Layout Editor.

Your button will now appear on all records that use this page layout.

Adding Custom Buttons in Lightning Experience

Lightning Experience doesn’t support the traditional Custom Buttons section in the same way Classic does. Here’s what works in Lightning:

Option A: Use Quick Actions (Recommended)

Quick Actions are Lightning-native and appear in the Highlights Panel or the action bar on a record.

To add a Quick Action:

  1. Go to Object Manager → [Your Object] → Buttons, Links, and Actions
  2. Click New Action
  3. Choose an Action Type (Flow, Visualforce Page, Lightning Component, etc.)
  4. Configure and save the action
  5. Go to Page Layouts and drag the action into the Salesforce Mobile and Lightning Experience Actions section

Option B: Use a Visualforce Button in Classic Mode

If your org uses both Classic and Lightning, you can still create a Visualforce-based button and it will render in the Classic detail view. This is not recommended for pure Lightning orgs.

Option C: Use Flow-Triggered Buttons via Screen Flow

Screen Flows launched from a button are the most powerful Lightning-compatible option. You can:

  • Build a Flow that collects inputs and runs automation
  • Wrap it in a Quick Action
  • Add it to the page layout as an action button

According to Salesforce’s own internal data, over 60% of new automation deployments in orgs running Lightning Experience use Flow instead of legacy JavaScript buttons.

Adding List Buttons to a Related List

If you created a List Button, it doesn’t go on the main page layout the same way. It goes on a related list.

  1. In the Page Layout Editor, find the Related Lists section
  2. Click the wrench icon on the related list where you want the button to appear
  3. In the Related List Properties popup, find the Buttons section
  4. Move your custom list button from Available Buttons to Selected Buttons
  5. Click OK, then save the layout

Profile-Level Visibility: Who Sees the Button?

Adding a button to a page layout doesn’t automatically mean everyone sees it. Visibility also depends on:

  • Which page layout is assigned to a user’s profile or record type
  • Permission sets if you’ve restricted certain actions
  • Record type assignments — different record types can use different page layouts

To check which page layout a profile uses:

  1. Go to Setup → Profiles → [Profile Name]
  2. Scroll to Page Layout Assignments
  3. Confirm the correct layout is assigned to the right profile for your object

If you’ve added the button to a layout that’s only assigned to certain profiles, only those users will see it.

Troubleshooting: Button Not Showing Up?

Button missing after saving the layout? Double-check that you saved the layout after dragging the button in. It’s easy to close the editor without saving.

Button shows in Classic but not Lightning? JavaScript-based buttons don’t render in Lightning. Convert to a Quick Action or Flow-triggered button.

Button visible to you but not your team? Check page layout assignments by profile. Your profile may be assigned a different layout than your team members.

Button runs but nothing happens? For URL-based buttons, check the URL is correctly formatted. For Visualforce-based buttons, confirm the VF page has the correct controller and is deployed.

List button not appearing on the related list? List buttons must be explicitly added to the related list’s button section — they don’t automatically inherit from the page layout’s main button area.

Quick Reference: Classic vs Lightning Custom Buttons

Feature

Salesforce Classic

Lightning Experience

Detail Page Buttons

✅ Supported

✅ Supported (with limitations)

JavaScript Buttons

✅ Supported

❌ Not supported

URL Buttons

✅ Supported

✅ Supported

Visualforce Buttons

✅ Supported

✅ Supported

Quick Actions

✅ Supported

✅ Recommended

Flow-based Buttons

✅ Supported

✅ Recommended

A Faster Way to Drive Pipeline — Without More Salesforce Setup

Here’s the thing about Salesforce: the more time you spend configuring it, the less time you spend actually filling it with qualified leads.

Custom buttons help your team work faster inside the CRM. But none of that matters if the pipeline going in is thin.

That’s where SalesSo comes in. We run complete LinkedIn outbound and cold email campaigns — from targeting and campaign design to scaling — that put qualified meetings on your calendar. No more empty stages. No more manually chasing cold leads.

While your competitors are busy tweaking page layouts, your team could be working inbound from a steady flow of outbound-generated opportunities.

Conclusion

Adding a custom button to a Salesforce page layout is a two-step process: first create the button under Buttons, Links, and Actions in Object Manager, then drag it onto the appropriate page layout. For Lightning Experience, Quick Actions and Flow-triggered buttons are your best path forward — JavaScript buttons are a Classic-only feature.

The key details to get right are: choosing the correct display type, ensuring the right page layout is assigned to the right profiles, and for list buttons, adding them explicitly to the related list’s button configuration.

Once it’s set up, your team saves clicks every single day. That’s the kind of efficiency that compounds.

And if you want that same compounding efficiency applied to your top-of-funnel pipeline — qualified leads arriving consistently without your team hunting for them — SalesSo builds that system for you. Complete targeting, campaign design, and scaling across LinkedIn outbound and cold email.

 

🚀 Skip the CRM Setup. Get Pipeline Now.

Stop configuring tools — start booking qualified meetings with decision-makers who actually want to talk.

7-day Free Trial |No Credit Card Needed.

FAQs

What is a custom button in Salesforce page layout?

A custom button in Salesforce is a clickable element added to a record's page layout that triggers a specific action — such as opening a URL, running a Visualforce page, or executing a Flow. It reduces manual steps for your team by surfacing quick actions directly on the record view. For sales and outreach teams, reducing internal friction with smarter CRM setup matters — but it only goes so far. If your pipeline is thin, no amount of automation inside Salesforce will fix it. SalesSo's complete outbound system — covering targeting, campaign design, and scaling across LinkedIn and cold email — fills your CRM with qualified opportunities consistently. Book a strategy meeting to see how we build pipeline for you.

Can I add multiple custom buttons to one page layout?

Yes. You can add as many custom buttons as you want to a page layout's Custom Buttons section. However, from a UX standpoint, it's best practice to limit visible buttons to 3–5 to avoid cluttering the record view and confusing users.

Do custom buttons work in Salesforce mobile?

Standard detail page buttons do not appear in the Salesforce Mobile App. To add buttons that work on mobile, use Quick Actions — they appear in the action bar on mobile record views and are fully supported.

What's the difference between a custom button and a quick action in Salesforce?

Custom buttons (detail page buttons) appear in the button bar of Classic-style layouts and support URL and Visualforce content. Quick Actions are Lightning-native, appear in the highlights panel and action menu, and support a wider range of action types including Flows and Lightning Components. For new Lightning implementations, Quick Actions are the recommended approach.

Can I restrict which users see a custom button?

Yes. Button visibility is controlled through page layout assignments. Assign different page layouts (with or without the button) to different profiles or record types. You can also control button behavior based on field values by using conditional visibility rules within Flows if the button triggers a Flow action.

We deliver 100–400+ qualified appointments in a year through tailored omnichannel strategies

What to Build a High-Converting B2B Sales Funnel from Scratch

Lead Generation Agency

Build a Full Lead Generation Engine in Just 30 Days Guaranteed