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.
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
Define a button with these attributes.
Display Type
List Button
Select Display Checkboxes (for Multi-Record
Selection) so users can select multiple records in
the list before clicking the button.
Behavior
Execute JavaScript
Content Source
OnClick JavaScript
Use this sample code. This example is for contacts. Change the object type for
a different type of record.
idArray = {!GETRECORDIDS($ObjectType.Contact)};
alert("The Ids you have selected are: "+idArray);
Add the button to the appropriate related list on a page layout or list view
layout.
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.