Custom Button and Link Considerations | Salesforce
Custom Button and Link Considerations
Keep these considerations in mind when working with custom buttons and links.
Available in: Salesforce Classic and Lightning Experience
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:
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 won’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, a custom list button that changes case status may 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 links on the home page can’t specify a controller.
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.
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 $Request global variable allows you to access query parameters inside a snippet, s-control, or custom button.
Don’t select Display Checkboxes (for Multi-Record Selection) for list buttons that link to a URL that doesn’t support post operations. Checkboxes display next to records in a list if you have selected Display Checkboxes (for Multi-Record Selection) for at least one list button in that list. However, selected records in this list are unaffected when clicking a custom list button that doesn’t have this option selected.
A custom link’s label can’t exceed 1,024 characters.
A link URL can be up to 2,048 bytes. When data is substituted for the tokens in the URL, the link can exceed 3,000 bytes. Some browsers enforce limits on the maximum URL length.
If you use URL custom buttons to pass parameters to standard pages in Salesforce Classic—such as pre-populating fields when creating a record—this behavior doesn’t work in Salesforce1 or Lightning Experience.
Custom buttons aren’t available for Web-to-Lead, Web-to-Case, the Case Teams related list, or the user object.