Creating Buttons in Salesforce Classic
System administrators can create new actions, buttons, or links and add them to a record's Page Layout. Buttons and links help integrate Salesforce data with external URLs, applications, custom code, a Visualforce page, or other back-end office systems.
Actions let users perform tasks, such as create records. You can also override the default action of some standard buttons and customize the behavior of tab home pages to suit your org’s needs.
Creating New Button for a Page Layout
The steps below provide an example of how to create a custom Customer Receipt button and add it to the Receipts page layout. This button will allow users to view the current receipt record. You can modify the below steps based on the button you’d like to create.
How to Add a Customer Receipt Button to a Receipts Page Layouts
- Navigate to the eBusiness App > Receipt and search for a record. For this example, the Receipt 0000000000 record is selected.
- Click the Lightning Gear button and click Edit Object. A new tab will open to the Receipt object in the Object Manager in Setup.
- Click Buttons, Links, and Actions from the left-side menu.
- Click the New Button or Link button in the upper right-hand corner. The New Button or Link creation page will open.
- From the New Button or Link creation page, enter the following settings to create the specific Customer Receipt button:
- Enter “Customer Receipt” in the Label field and press the tab key on your keyboard to auto-populate the Name field below.
- Enter any optional text in the Description field.
- Select the Detail Page Button in the Display Type section.
- Select Display in existing window without sidebar or header in the Behavior section.
- Select URL as the Content Source.
In the Text Area, enter the redirect URL for the custom page as follows: /apex/{!$Setup.OrderApi__App_Config__c.OrderApi__Namespace_Prefix__c}receipt?id={!OrderApi__Receipt__c.Id}
Note
The Selected Field Type, Insert Field, Insert Operator, Functions, and Check Syntax fields and buttons can be used to add desired attributes for your own custom button action to the text area.
- Once the URL text is added, click the Preview button at the top of the window to preview your button.
- If you're satisfied with your button, click Save. This button will now be available to add to the Page Layout for the Receipt Object.
To add the new button to the Receipt Object’s Page Layout:
- Return to Receipt 0000000000.
- Click the Lightning Gear button and [Click] Edit Object. A new tab will open to the Receipt object in the Object Manager in Setup.
- Click Page Layouts from the left-side menu.
- Select the most recent layout for your object. The page layout will open.
- From the left column of the Receipt Layout – Master page, click Buttons to display the available buttons. Verify Customer Receipt button is available.
- Scroll-down on the page until you see the Receipt Detail and Custom Buttons section.
- Drag-&-Drop the Customer Receipt button to the Custom Buttons section.
- Click Save. The new Customer Receipt button will be added to the desired record's page layout. Click the Customer Receipt button to view the current receipt record.