Sample Image Formula Fields Customization Guide
Sample Image Formula Fields Customization Guide
Copyright 2005, salesforce.com, inc. All rights reserved. Salesforce.com is a registered trademark of
salesforce.com, inc. All other trademarks mentioned in this document are the property of their respective owners.
INTRODUCTION
With the Winter 06 release, formula fields allow the incorporation of images into standard and custom tabs,
list views, and reports. Because people recognize images more quickly than they can read words, adding
images to Salesforce can enable users to find the data theyre looking for more quickly. For example,
Photos for product catalogs or employee directories
Graphical representations of status, priority, or rating
Clickable Buttons
Online Presence Indicators
Images are displayed using a new formula function called IMAGE. Similar to the HYPERLINK function,
IMAGE works by inserting HTML tags into text formulas. The formula syntax is,
IMAGE( image_url, alternate_text, image_height, image_width )
This results in the following HTML:
<IMG SRC=image_url ALT=alternate_text HEIGHT=image_height WIDTH=image_width BORDER=0>
Thus, the IMAGE function can display any image file on a web server or file server accessible from the
users web browser.
Test whether an image file is accessible from the users web browser by entering the image_url directly
in the browsers address bar. If the browser displays the image, you can use the image_url in the IMAGE
function. For example, try the following image file:
http://www.salesforce.com/us/assets/logos/sfdc_223x78.gif
You can reference images stored within your own corporate intranet, but be aware that when your users
login to salesforce.com from outside your firewall, they will not be able to see the images.
The image_height and image_width parameters allow you to specify the display size (in pixels) of the
image file. If you want to display the image file at its actual size, you can omit these two parameters:
IMAGE( "/img/samples/color_green.gif", "1x1 pixel green image")
IMAGE( "/img/samples/color_green.gif", "green image scaled to 50x50 pixels", 50, 50)
You can display images stored in the Documents tab using a special URL and the image files document
ID:
IMAGE( "servlet/servlet.FileDownload?file=015x00000000f7e", "image from Documents tab")
The document ID (e.g., 015x00000000f7e) is a unique identifier for each file stored in the Documents
tab. It is shown in the browsers address bar when you look at the files detail page in the Documents
tab.
-2-
You can use image fields anywhere you can use custom
formula fields standard and custom tabs, list views,
reports, etc. The only exceptions are email templates and
mail merge documents (both of which we plan to support in
a future release).
-3-
IF(LEN({!Yahoo_Name__c})=0,"",
HYPERLINK("ymsgr:sendIM?" &
{!Yahoo_Name__c},
IMAGE("http://opi.yahoo.com/online?u=" &
{!Yahoo_Name__c} & "&m=g&t=0", " ")))
IMAGE(
CASE( {!priority},
"Low", "/img/samples/flag_green.gif",
"Medium", "/img/samples/flag_yellow.gif",
"High", "/img/samples/flag_red.gif",
"/s.gif"),
"priority flag")
IMAGE(
CASE( {!Project_Status__c},
"Green", "/img/samples/light_green.gif",
"Yellow", "/img/samples/light_yellow.gif",
"Red", "/img/samples/light_red.gif",
"/s.gif"),
"status color")
IMAGE(
CASE( {!Rating__c},
1, "/img/samples/stars_100.gif",
2, "/img/samples/stars_200.gif",
3, "/img/samples/stars_300.gif",
4, "/img/samples/stars_400.gif",
5, "/img/samples/stars_500.gif",
"/img/samples/stars_000.gif"),
"rating")
IMAGE(
CASE( {!Rating__c},
1, "/img/samples/rating1.gif",
2, "/img/samples/rating2.gif",
3, "/img/samples/rating3.gif",
4, "/img/samples/rating4.gif",
5, "/img/samples/rating5.gif",
"/s.gif"),
"rating")
-4-
IMAGE("/img/samples/color_green.gif",
"green", 15, {!Industry_Score__c} * 2) &
IMAGE("/s.gif", "white", 15,
200 - ({!Industry_Score__c} * 2))
IMAGE( "/servlet/servlet.FileDownload?file="
& {!Photo_Doc_ID__c}, "photo")
IMAGE("http://intranet/photos/photo_" &
{!Employee_ID__c} & ".jpg", "photo")
HYPERLINK("http://finance.yahoo.com/q/bc
?s=" & {!TickerSymbol} & "&t=1d",
IMAGE("http://ichart.yahoo.com/t?s=" &
{!TickerSymbol} , "Ticker Image", 96,192) )
-5-
/img/samples/color_green.gif
/img/samples/color_red.gif
/img/samples/color_yellow.gif
/img/samples/flag_green.gif
/img/samples/flag_red.gif
/img/samples/flag_yellow.gif
/img/samples/light_green.gif
/img/samples/light_red.gif
/img/samples/light_yellow.gif
/img/samples/priority_1.gif
/img/samples/priority_2.gif
/img/samples/priority_3.gif
/img/samples/priority_4.gif
/img/samples/priority_5.gif
/img/samples/rating1.gif
/img/samples/rating2.gif
/img/samples/rating3.gif
/img/samples/rating4.gif
/img/samples/rating5.gif
/img/samples/stars_000.gif
/img/samples/stars_100.gif
/img/samples/stars_200.gif
/img/samples/stars_300.gif
/img/samples/stars_400.gif
/img/samples/stars_500.gif
-6-