Display an icon on a record page
You can use a formula field to display an icon on a record page. For example, you can display a country flag on a team member record, or an icon to indicate disability or other needs on a candidate record.
For example:
This example walks you through the steps of adding an icon to the candidate record. The steps you need to take:
-
Gather the icons you want to use. If necessary, resize them at this stage.
-
Add the icons into Files in your org:
-
In your org, select the App Launcher and then select Files:
-
In Files, select the library where you want to upload the icons. Make sure you select a public library, such as the Asset Library in the screenshot:
-
In the library, select Upload Asset File:
-
After uploading select the image name to open it in preview mode:
-
In the preview mode right click and select Copy image address.
The copied image address looks something like this:
https://<org domain>.file.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=ORIGINAL_Png&versionId=068QH000001IHRd&operationContext=CHATTER&contentId=05TQH000002qT9p
To use the image in a formula field you only need the parts starting from
/sfc/
.
-
-
Add a formula field to the candidate record:
-
Go to Setup > Object Manager, and select the Candidate object.
-
From the sidebar select Fields & Relationships.
-
Select New and create the new field with the following details:
-
Field data type: Formula
-
Formula return type: Text
-
Formula:
IMAGE(image_url, alternate_text, height, width)
where:-
image_url
is the image address you copied from the image details, in quotation marks. -
alternate_text
is the text to display if the image cannot be displayed, also used by screen readers. -
height
is the image height in pixels. Optional. -
width
is the image width in pixels. Optional.Not entering height and width can lead to the icon being not displayed in full in reports.
For example:
IMAGE("/sfc/servlet.shepherd/version/renditionDownload?rendition=ORIGINAL_Png&versionId=068QH000001IHRd&operationContext=CHATTER&contentId=05TQH000002qT9p", "Disability_Icon", 30, 30)
You can combine the IMAGE function with an IF condition to only display the image if the condition of true. For example:
CopyExample: IF with IMAGE
IF(
Has_Disability__c,
IMAGE("<image address>", "Disability icon", 30, 30),
NULL
) -
-
-