Images inside salesforce.com fields

Standard

Sometimes it is better to represent something with an image or icon rather than text. In salesforce.com you can show images on your pages. And these images can be driven by formulas, thus making them dynamic.

A few examples:

  • If a customer is on Credit Hold show a red flag
  • If a customer has X in sales show a certain image to represent they are a special customer
  • If a customer as a certain type of agreement with you show X image to represent that
  • If a contact hasn’t been “touched” in X days show an image to represent that fact

Lets take the Credit Hold scenario as an example. Say you have a custom field named Credit Rating (credit_rating__c) on the Account object. This is a picklist that has the values of Excellent, Good, Poor, On-Hold. When the customer is on hold you want to show a Red Flag on the Account page layout.

To show images we use the Image function in a formula field. The image can be a local salesforce.com image or you can link to any image on the web.

Okay, lets give it a shot. Here are the steps.

  1. Create a new field on the Account object.
    1. Data type is Formula field
    2. The label name will Credit Standing (credit_standing as the field name)
    3. Choose Text as the Return Type
  2. In the formula section paste in the following
    • IF (credit_rating__c = “On-Hold”, IMAGE(“/img/samples/flag_red.gif”, “red”), IMAGE(“/img/samples/flag_green.gif”, “green”))
  3. Click Next
  4. Choose the profiles you want to have access to this new field
  5. Click Next
  6. Choose the Page Layouts you want this new field to show up in.
  7. Click Save

So what will happen now is a Red Flag will show up if Credit Rating = On-Hold or else it will show a Green Flag. I am utilizing some salesforce.com icons. You can find all the icons  here – http://free-121d5f44d20-121d603d1c5-121ee2b8103.force.com/force2b/salesforceicons . You want to get the URL of the image and then just change it a bit.  Example:  Red flag URL from that page is http://free-121d5f44d20-121d603d1c5-121ee2b8103.force.com/img/samples/flag_red.gif . Take away everything before /samples and that is what you will use in the formula.

Coming soon after this I will show an example of how to have more than one image show up in an image formula field.

Leave a Reply

Your email address will not be published. Required fields are marked *