How to Create Clickable Image in Salesforce

In our Salesforce org, I was working on a requirement for the sales team to customize record pages. They wanted to see the company logo on the account record page, and when clicked, it should redirect them to the company’s official website.

In Salesforce, there are two ways to add a clickable image as a field on the object record page: using a formula field or a rich text field.

In this Salesforce tutorial, I will explain how to create a clickable image in Salesforce with custom fields.

Clickable Image in Salesforce

In Salesforce, a clickable image is similar to a hyperlink that redirects to the embedded link when clicked. It combines the functionality of a hyperlink with the visual of an image, making Salesforce pages interactive.

For example, on an account record, we can show the company’s logo as a clickable image that redirects to the company’s official website.

Create a Clickable Image in Salesforce

To create a clickable image in Salesforce, there are several ways that we will discuss in the examples below.

  • Create a clickable image using a formula field in Salesforce
  • Create a clickable image using a text field in Salesforce

Create a Clickable Image Using a Formula Field in Salesforce

To create a clickable image in Salesforce, the easiest way is by using the object fields. In this example, I will show how to create a clickable image in Salesforce by using a custom formula field.

Now, navigate to the setup page of Salesforce Lightning and follow the steps below.

  1. On the setup page of Salesforce Lightning, select Object Manager, then the object in which you want to create a clickable image. In this example, I have selected the Account object.
Create a clickable image in Salesforce Lightning
  1. In the object setup, go to Fields and relationships and click New.
Custom field for clickable image in Salesforce
  1. Select the field type as Formula. In the next window, enter the field label and select the return type as Text. After this, click on the Next button.
Add clickable image in Salesforce record page
  1. Enter the formula below in the formula editor and click Next.
HYPERLINK(
   "https://salesforcefaqs.com/", 
   IMAGE("/resource/Clickable", "Salesforce", 50, 50),
   "_blank"
)

We have defined the formula as follows:

  • https://salesforcefaqs.com: The link you want to open when the image is clicked.
  • /resource/Clickable: Path of the image (upload it first as a Static Resource).
  • Salesforce: Alt text (displayed if image fails to load).
  • 50, 50: Width and height of the image.
  • “_blank”: Opens the link in a new tab.
  1. To set up the field-level security, select the profiles that can access this field for the clickable image.
Create hyperlink image in Salesforce
  1. Select the page layouts to make the custom field visible on the record pages and click Save.
Add hyperlink to image in Salesforce

Navigate to the object record page, and there you will see the custom field with the image from a static resource. As we click on the image, it will redirect to the URL that we have used in the formula.

Link URL with image in Salesforce

This way, we can add a clickable image in Salesforce using a custom formula field.

Create a Clickable Image Using a Rich Text Field in Salesforce

Another way to create a clickable image in Salesforce is by using the custom rich text area field.

First, create a rich text field in the object, then follow the steps below to create a clickable image using a rich text field in Salesforce.

  1. After creating the custom rich text area field, open the object record in Edit mode.
Add clickable image in Salesforce record
  1. Go to the rich text field and add an image from the static resource or upload it from the system.
Salesforce Lightning clickable image
  1. Select the uploaded image and click on the link icon. Here, add the link title, then in the Link URL, add the target URL that should open when we click on the Image. After this, click on the Save button.
Add clickable image using hyperlink in Salesforce
  1. Now, in the preview mode, when we click on the image, it will redirect to the URL that we have linked to the image.
Link image with URL in Salesforce

This way, we can create a clickable Image using a custom rich text field in Salesforce.

Conclusion

In this Salesforce tutorial, we learned how to create a clickable image in Salesforce. In the above examples, we explored two methods: using a formula field and using a rich text field. Both methods enable us to display an image that functions like a hyperlink, redirecting to a target URL when clicked.

By following the above steps, you can add a clickable image on record pages to provide quick navigation to external or internal resources directly from Salesforce.

You may also like to read:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.