IMAGE() formula function to display status flags, traffic lights, due-date warnings, and progress bars directly on record page layouts and list views.
Displaying visual indicators on records helps sales and support teams quickly identify high-priority items without reading through dense text or numeric fields. Salesforce allows developers and administrators to render standard icons, custom indicators, and dynamic progress bars using formula fields and custom page markups.
1. How to Use the IMAGE() Formula Function
The standard Salesforce IMAGE() function takes up to four arguments to render dynamic graphics inside custom formula fields with a Text return type:
- Image_URL: The relative platform path or full web URL of the image file.
- Alternate_Text: Accessible text displayed when the image fails to load or for screen readers.
- Height (Optional): The image height in pixels.
- Width (Optional): The image width in pixels.
Displaying tiered status icons based on opportunity amounts:
IF(Amount > 100000,
IMAGE("/img/samples/flag_green.gif", "Tier 1 - High Value", 20, 20),
IF(Amount > 50000,
IMAGE("/img/samples/flag_yellow.gif", "Tier 2 - Medium Value", 20, 20),
IMAGE("/img/samples/flag_red.gif", "Tier 3 - Standard Value", 20, 20)
)
)
2. Common Standard Graphic Paths in Salesforce
Salesforce hosts a collection of default icons and status indicators accessible via standard relative URLs. These can be referenced directly in formulas or Visualforce pages without consuming file storage:
- Traffic Light Indicators:
/img/samples/light_green.gif(Green Light)/img/samples/light_yellow.gif(Yellow Light)/img/samples/light_red.gif(Red Light)
- Priority Flags & Stars:
/img/samples/flag_green.gif,/img/samples/flag_red.gif/img/samples/stars_500.gif(5 Stars Rating)/img/samples/stars_100.gif(1 Star Rating)
- System & Notification Icons:
/img/msg_icons/confirm32.png(Success Checkmark)/img/msg_icons/error32.png(Error Alert)/img/msg_icons/warning32.png(Warning Triangle)
3. Dynamic Progress Bars and Due Date Warnings
Combining numeric calculations with horizontal color bars creates dynamic progress meters and visual alert badges on task layouts.
Displays a warning icon whenever an open task is past its due date:
IF(AND(NOT(IsClosed), ActivityDate < TODAY()),
IMAGE("/img/msg_icons/error24.png", "Past Due!") & " Overdue Task",
IMAGE("/img/msg_icons/confirm24.png", "On Track") & " On Schedule"
)
Renders a colored progress bar scaled to completion percentage:
IMAGE("/img/samples/color_green.gif", "Progress", 12, (Percent_Complete__c * 200)) &
IMAGE("/img/samples/color_grey.gif", "Remaining", 12, (200 - (Percent_Complete__c * 200)))
- Formula Field Return Type: Must always be set to Text.
- Classic vs. Lightning Compatibility: Standard
/img/paths render seamlessly across both Lightning Experience and Salesforce Classic. - Lightning Native Alternative: For custom UI development, use modern SVG icons from the Salesforce Lightning Design System (SLDS) via
<lightning-icon>in LWC. - Static Resources: For custom company branding, upload icons to Static Resources and reference them using relative resource paths.
4. Common Traps & Implementation Rules
Never prefix image URLs with instance domains (e.g.,
https://na139.salesforce.com/img/...). When your sandbox refreshes or your org migrates to Hyperforce or a new My Domain instance, hardcoded domain URLs break. Always use relative paths starting with /img/ or reference $Resource.
IMAGE() formula to preserve screen reader accessibility and report export readability.
- Explicit Width & Height: Define pixel dimensions explicitly in the formula arguments to prevent layout shifts while pages render.
- Handling Null Values: Use
BLANKVALUE()orNULLVALUE()guards around numeric fields to avoid broken image formulas when values are missing.
Summary
Adding visual cues to Salesforce records transforms standard detail pages and list views into actionable dashboards. By leveraging standard image paths, building nested IMAGE() formulas, and avoiding hardcoded domains, you can create dynamic status indicators and progress bars that scale across all environments.