Custom Button and Link Samples

Use samples of custom Salesforce buttons and links to determine whether they can work for you.

Required Editions

Available in: Salesforce Classic

Custom buttons and links are available in: All Editions

Visualforce pages and s-controls are available in: Contact Manager, Group, Professional, Enterprise, Performance, Unlimited, and Developer Editions

User Permissions Needed
To create or change custom buttons or links: Customize Application
  • Custom Link Example: Link to Documents
    Use custom links to reference documents from a Salesforce record detail page.
  • Custom Link Example: Link to Files in Chatter
    Use custom links to reference files from Chatter.
  • Custom Link Example: Link to Reports
    Use custom links to run reports with filtered results from a Salesforce record detail page. For example, let’s say you frequently run a mailing list report for the contacts related to an account. You can create a custom link for accounts that links directly to a report that is automatically filtered to the account that you’re viewing. In this case, your custom link must pass the account’s unique record ID to the report.
  • Custom Button Example: Mass Delete
    This example creates a JavaScript custom button for Salesforce Classic that can be added to activity-related lists and list views and allows users to delete selected records at the same time.
  • Custom Button Example: Display Alerts
    This example creates a button that opens a window with a welcome message containing the user's first name.
  • Custom Button Example: Clone Records
    The clone button is available for most standard objects. When a clone button is not available by default for a standard or custom object, you can create a custom clone button or link. This example creates a button that passes the field values of the record you’re on to a record create page.
  • Custom Button Example: Get Record IDs
    This example creates a button that opens a window listing record IDs for user selected records. Getting record IDs is useful when testing to ensure that you have the correct records before processing them further.
  • Custom Button Example: Pass Record IDs to an External System
    You can use Salesforce record IDs as unique identifiers for integrating with an external system. This example creates a button that calls a Visualforce page to determine the record IDs of selected records and passes them in a URL query parameter to an external Web page called www.yourwebsitehere.com.
  • Custom Button Example: Record Create Page with Default Field Values
    Construct custom buttons and links that pass default field values to a record create page. This feature applies to Lightning Experience in all editions. This feature doesn’t apply to Lightning Out, Experience Builder sites, or the Salesforce mobile app.
  • Custom Button Example: Reopen Cases
    This example creates a button that can be added to cases related lists so that users can reopen several cases on an opportunity at once.
  • Custom Link Example: International Maps
    This example creates a link that displays a country-specific Google map.