Friday, March 12, 2021

Adding Image to Salesforce

Adding Image to the Lightning page

This is actually pretty simple:

  • add a Rich Text component in Lightning App Builder
  • copy the image from a browser
  • paste into the Rich Text component 
Bonus point, since this is a component, you can make use of "Set Component Visibility" to show/hide the Rich Text component based on the record field value or device or user detail or permission. Also, can use filter logic to show/hide the component.

In the rich text component, you can combine this formatted text and additional images.

Adding Image to Page Layout

Salesforce does not have a field with the type = image, however, we can make use formula field return text with the Image() formula. 

IMAGE(image URL, alternate text [, height, width])

You can enter any URL into the image URL, such as: 
IMAGE("", "Hello", 157, 627)

or simply populate the Image URL and alternate text for the parameter

However, the above image is public or depends on external storage. We can make use of the Salesforce library to store the images, check out this article

Static Resources
Another option is to load the image as Static Resources.

IMAGE("/resource/This_is_image", "Hello")

Since this is a formula field, you can make use of IF() function to determine which image to show based on the criteria.

FREE Images Components 📷 by SharinPix

FREE Images Components 📷 by SharinPix is a native Salesforce picture management based on Salesforce images capabilities. Use the components to display images on a record page. Choose from a banner format, photo album, slideshow or a slider. You can even upload images from the components as well!

Check out this component from AppExchange, or the paid version Image/Photo Management for Salesforce for more features.


  1. Hello,

    I used the formula field to display the product Images but its only good got 5000 Compile size. Wnated to know if there is an option for to display 100+ products

    1. I don't think using formula is a good idea to display many combination of images, have you look at idea exchange


Page-level ad