Adding Custom Color Flag Fields in Salesforce

Salesforce no longer allows you to create custom fields with custom background colors. However, you can add images to custom fields. Let’s say you wanted to create a custom field to identify case age in business hours. For this example, we’ll identify a case opened within 24 hours with a green flag, a case opened within 48 hours with a yellow flag and a case opened longer than 48 hours with a red flag.
You’ll need to create a customer formula field with a Text return type. The code below will add the flag icons along with the number of hours the case has been opened.

IF(FLOOR((NOW() - CreatedDate)*24) < 24,
IMAGE("/img/samples/flag_green.gif", TEXT(FLOOR((NOW() - CreatedDate))*24)) & " " & TEXT(FLOOR((NOW() - CreatedDate)*24)),
IF(FLOOR((NOW() - CreatedDate)*24) < 48,
IMAGE("/img/samples/flag_yellow.gif", TEXT(FLOOR((NOW() - CreatedDate)*24))) & " " & TEXT(FLOOR((NOW() - CreatedDate)*24)),
IMAGE("/img/samples/flag_red.gif", TEXT(FLOOR((NOW() - CreatedDate)*24))) & " " & TEXT(FLOOR((NOW() - CreatedDate)*24))))

Once you’ve created your custom formula field, add it to a view and you should have a view similar to the image below:

Salesforce

Color Flags in Salesforce




4 Comments

Hi,

Is it possible to make those flag icons blink (or flash as to highlight the effect visually?

Thank you so much,
Skender

Leave a Reply

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

Please Do the Math      
 

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: