How to Create Custom Buttons and Links

Introduction

On multiple occasions, your team may require immediate access to other pages both inside and outside your org, it could be external URLs, applications, backend office systems, or your company’s intranet. What if your user did not have to leave the Lightning page they’re working on to access what they need? → Custom Buttons and Links to the rescue! Custom Buttons and Links are yet another productivity-boosting functionality offered by Salesforce.

What are Custom Buttons and Links?

Custom Buttons and Links help integrate your org with those external URLs or applications that are frequently accessed by your team. You can add them to the object and record detail pages, and voila, they’re just a click away from your User. See how this could help your Users get their work done in the blink of an eye?

What Can Custom Buttons and Links Do?

Custom Link – Can link to an external URL, such as www.yahoo.com, a Visualforce page, or your company’s intranet. They can also link to custom s-control, such as a Java applet or Active-X control in the custom s-control library.

Custom Buttons – Can connect users to external applications such as a web page or can be used to launch custom links. They are also used to run an s-control from the s-control library.

Salesforce offers three primary types of custom buttons and links :

How to Create a Custom List Button?

A List Button can be created on a related list in an object record page. They are visible on an object’s related list whenever the related list appears on another object’s record page.

Remember the Energy Audit object we created? Energy Audit objects have a lookup relationship with Account objects, so the Energy Audit-related list is visible on the Account record page.

We created the GHS review (Energy Audit) for Grand Hotels & Resorts Ltd (Account). We need a Custom Button to be visible in the Energy Audit related list under the Related tab of Grand Hotel & Resorts Ltd.

This button is going to enable users to access an Energy Audit Guideline PDF from the account record page with just a click.

Let’s begin!

1. From the App Launcher, open the Sales app.

2. Click the Files tab on the navigation bar.

3. Upload a file of your own to continue. You can see the PDF file I’ve uploaded – AUDIT_GUIDELINES.

Graphical user interface, application Description automatically generated

4. Click Action dropdown next to the file you uploaded and select Public Link.

5. Click Create Link in the pop-up that appears, then click Copy Link and close the pop-up.

6. From Setup, click Object Manager and then open the Object – Energy Audit.

7. From the sidebar, click Buttons, Links and Actions.

8. Click New Button or Link in the top-right corner.

9. In New Button or Link, fill in the following :

  • Label: Audit Guidelines
  • Display Type: List Button
  • In the large text box, paste everything after the domain portion of the URL you copied.
    For Example, if your URL is https://curious-impala-owhvvv-dev-ed.my.salesforce.com/sfc/p/5j00Aehum/a/5j000MHev/4HmhwenblrQ6pj0gEZBagGjNPyeBlEdbj3YlAmakpcU.

We only need /sfc/p/5j00Aehum/a/5j000MHev/4HmhwenblrQ6pj0gEZBagGjNPyeBlEdbj3YlAmakpcU.

Graphical user interface, text, application Description automatically generated

10. Leave the rest as is, and click Save.

11. Click Close.

What we did here is create a button, but the button won’t be visible until we add it to the Page Layouts of the Account object. Let’s do that now.

1. From Setup, click Object Manager, and open Account.

2. From the sidebar, click Page Layouts.

3. Open the Layout that is currently assigned to your profile, I’m using New Account Layout, a custom page layout I created.

4. Scroll down to find the Energy Audit-Related Lists.

5. Click on the wrench icon.

6. Click on the + icon to expand the Buttons section.

Graphical user interface, application Description automatically generated

7. Add Audit Guidelines onto the Selected Buttons list, then click OK.

8. Click Save.

9. Find your way back to the Sales App, click the Accounts tab, and Select Grand Hotels & Resorts Ltd.

10. Click on the Related tab, and scroll down to the Energy Audits related list to find the Audit Guidelines button there!

Graphical user interface, application Description automatically generated

How to Create a Custom Detail Page Link?

A Detail Page Link can be viewed in the Links section of record details on the object record page.

We want the consultants working on Energy Audits to have quick access to the current U.S national average cost of electricity. This is so that they can compare the national average against what the customer is paying. Let’s add the detail page link in just a few short steps.

1. From Setup, open Object Manager, and then click Energy Audit.

2. From the sidebar, open Buttons, Links and Actions.

3. Click New Button or Link.

4. Fill in the following :

5. Leave the rest as is, click Save, then click Close.

We’re halfway there, we still need to add the custom link onto the page layout to make it visible to our Users.

6. Now, select Page Layouts from the sidebar.

7. Open Energy Audit Layout.

8. Drag and drop US Energy Average Cost Link from Custom Links on the palette onto the page layout.

Graphical user interface, text, application Description automatically generated

9. Click Save.

10. From the App Launcher, open the Energy Consultations App, click on the Energy Audits tab and open any Energy Audit record. The link should be visible under the Details tab.

Graphical user interface, text, application, email Description automatically generated

How to Create a Custom Detail Page Button?

A Detail Page Button is visible in the action menu in the highlights panel of an object record page. Let’s add a Detail Page Button to the action menu of the Opportunity object. This button shows the opportunities’ internet footprint.

1. From Setup, open Object Manager, then open Opportunity.

2. From the sidebar, select Buttons, Links and Actions.

3. Click New Button or Link.

4. Enter the following:

5. Click Save, then click Close.

We’re almost there, let’s add the Custom Button to the page layout of Opportunity.

1. Select Page Layouts from the sidebar.

2. Open Opportunity Layout.

3. Drag Internet Footprint in Buttons from the Palette onto the Page Layout.

Graphical user interface, text, application Description automatically generated

4. Click Save.

5. Navigate to any Opportunity record to find the button on the action menu.

Graphical user interface, text, application Description automatically generated

Image Source

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.