top of page

When Admin met Developer - Adding Colors to the Fields Values

One bright morning, Debbie (our developer from the story) got a weird requirement. The requirement was to make Rating field on the Lead object as follows:

  • If Lead is Hot - Text should be red.

  • If Lead is Warm - Text should be Orange.

  • If Lead is Cold - Text should be blue.

So over the lunch, she discussed this requirement with our #AwesomeAdmin Adam. After listening to the requirement, he told Debbie that this requirement requires a formula field only using chart.googleapis! Debbie was excited, as she was planning to go with a custom solution but now she was amazed by this solution.


So, Adam shared this approach to make any field in salesforce colorful with different sizes (without writing a single line of code). He asked Debbie to follow these steps to create a formula field on the required object.


1) Create a formula field of type Text.

2) Use IMAGE formula in the Formula

IMAGE(image_url,alternate_text,height,width)

3) Replace image_url with the link below. (How this works? mentioned at last)

4) Your Formula should look like this

CASE(
TEXT(Rating),

'Hot',IMAGE('https://chart.googleapis.com/chart?chst=d_text_outline&chld=FF0000|30|l|FF0000|_|HOT','HOT'),

'Warm',IMAGE('https://chart.googleapis.com/chart?chst=d_text_outline&chld=FFA500|25|l|FFA500|_|WARM','WARM'),

'Cold',IMAGE('https://chart.googleapis.com/chart?chst=d_text_outline&chld=0000FF|20|l|0000FF|_|COLD','COLD'),

NULL
)

5) Save your field and add the formula field to the custom layout.

6) Go to the Record page and see the magic!

So how this chat.googleapis formula works

So this is the syntax of this link -

https://chart.googleapis.com/chart?chst=d_text_outline
chld=<text_fill_color>|<font_size>|<text_alignment>|<outline_color>|<font_weight>|<text_line_1>|...|<text_line_n>
 

Check this blog to know about the story, of When Admin met Developer.


375 views0 comments

Recent Posts

See All
bottom of page