Custom Button and Link Considerations
Keep these considerations in mind when working with custom buttons and links.
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 |
Implementation Tips
- Custom buttons display at the top and bottom of the detail page to the right of all standard buttons.
- Custom buttons aren’t distinguished from standard buttons in any graphical way. However, you can recognize them by their location on the right of all standard buttons.
- If the button bar gets too wide on the detail page layout, the browser displays a horizontal scroll bar. If the button bar gets too wide on the list view, search result, tagging result, or related list layouts, the buttons wrap.
- Custom buttons are available for activities under the individual setup links for tasks and events. To add a custom button to an activity list view or search layout, first create a custom list button in tasks or events. Next, add it to your activity list view or search result layouts. You can override a button that applies to both tasks and events.
- Person Account records use the custom buttons and links you have made for accounts.
- If your organization uses the Console tab, list buttons are available in Mass Action. List buttons don’t display in the mini page layouts. Pages that display due to custom buttons and links display in the console without the header or sidebar.
- If you get an error message when overriding a button that appears in a list, try calling the s-control using the URLFOR function.
- When creating custom buttons, be aware of any validation rules your organization has for records on that object. For example, some custom list buttons that change case status conflict with a case validation rule. In this scenario, Salesforce displays the error message for the validation rule when users click the custom button.
- To replace a standard button with a custom button, first define the custom button, then customize the page layout to hide the standard button and display the custom one in its place.
- Visualforce pages used as custom buttons or links on detail pages must specify a standard controller of the same object.
- Visualforce pages used as custom list buttons must use a standard list controller of the same object.
- A web tab or custom link could display a blank page if the embedded site:
- Has been set to deny the loading of its content in a frame.
- Has been set to allow the loading of its content in a frame only if the same site is delivering the content.
- Contains a mix of secure and unsecure content, and the user’s browser has been configured to block mixed active content.
- Set your custom link to either open in a new window or display in the existing window without the sidebar or header.
- Move the URL from a web tab into a custom link instead. Set the URL to either open in a new window or display in the existing window without the sidebar or header.
- If the site you’re embedding has an HTTP prefix and mixed active content, try changing the prefix to HTTPS. If the embedded site has a valid security certificate and it hasn’t blocked itself from being displayed in frames, using HTTPS as the prefix allows the site to display.
Best Practices
- Use formula functions in custom buttons with caution. Because functions run on the server before your HTML or JavaScript is passed to the browser, they can only evaluate information that exists at that time. Don’t use functions like IF to evaluate conditions that only exist when the code reaches the browser, such as the value of a JavaScript variable that your code returns.
- Use relative or absolute URLs as the content source for custom buttons or links to ensure that they’re rendered correctly.
- To prevent a user from performing a particular action, such as creating or editing, change the user’s permissions rather than hiding the standard button. Hiding a standard button removes it from a page layout, but the link is still available and users can navigate to the new or edit page manually.
- Use global variables to access special merge fields for
components like custom buttons, links, and s-controls. For example, the
$Requestglobal variable allows you to access query parameters inside a snippet, s-control, or custom button. - When you create a custom list button, select Display Checkboxes (for Multi-Record Selection) only if your list button requires users to select individual records in a list. If your list button doesn’t require users to select individual records, don’t select this option. Don’t select Display Checkboxes (for Multi-Record Selection) if your list button links to a URL that doesn’t support POST operations, such as a URL that links to a Lightning component.
- In Lightning Experience, when you select Display Checkboxes (for Multi-Record Selection), the related list type must be set to Enhanced List. You can set the related list type from the Related List–Single component or Related Lists component on a record page in the Lightning App Builder.
- If you create multiple custom list buttons on a list and select Display Checkboxes (for Multi-Record Selection) for at least one of the list buttons, checkboxes appear next to records in the list. But those checkboxes aren’t activated for custom list buttons without Display Checkboxes (for Multi-Record Selection) selected.
Considerations for the Salesforce Mobile App
- Custom buttons that are added to the Button section of a page layout and that
define the content source as URL or
Visualforce are supported in the Salesforce mobile
app. Remember that Visualforce pages must be enabled for use in the Salesforce
mobile app.
Custom links, custom buttons that are added to list views, and custom buttons that define the content source as OnClick JavaScript aren’t available in the Salesforce mobile app.
- Using custom URL buttons to pass parameters to standard pages in Salesforce Classic—such as prepopulating fields when creating a record—doesn’t work in the Salesforce mobile app.
-
Custom images used for action icons must be less than 1 MB in size.
Did this article solve your issue?
Let us know so we can improve!

