Skip to main content

Dynamic Field Coloring Based On Status In Salesforce

Hello Awesome Readers!

Have you ever wanted to make your Salesforce forms more visually interactive? Imagine seeing a green icon when a claim is approved or a red one when it’s rejected. That’s exactly what we’re diving into today!

In this quick tutorial, I’ll walk you through how to dynamically change the color (via images) of a field in a Salesforce claim form—based on the Status of the case. Let’s get into it!

The Requirement:
We want to update the field color based on the "Status" field in a case. For example:
Green when the status is "New"
Red when the status is "Escalated".

The Solution – Step-by-Step
1. Download Your Color Icons
First, grab or create two simple colored icons (in PNG format). Let’s say:
Green dot for New status
Red dot for Escalated status

2. Upload Green Icon as a Static Resource
    Head over to Setup > Static Resources, and upload your green ic

3. Upload Red Icon as Another Static Resource
    Repeat the same for the red icon.
    
4. Create a Formula Field
    Go to the Case object, and create a new field:
   Type: Formula
    Return Type: Text

5. Add Your Logic in the Formula
Now, let’s write the logic to display different images based on the status.
Here’s a simple example:
IF(
   ISPICKVAL(Status, "New"),
   IMAGE("/resource/GreenColorResource", "New", 20, 20),
   IF(
   ISPICKVAL(Status, "Escalated"),
   IMAGE("/resource/RedColorResource", "Closed", 20, 20),
""
)
)
This formula checks the value of Status and shows the corresponding image.

6. Save and Test!
Now go back to a case record and try changing the status.
On status New.

On status Escalated.

That’s It!
And there you have it—your field now visually reflects the case status with colorful icons. This is not just eye-catching but can also improve user experience by helping teams instantly recognize claim states.

Was This Helpful?
If this guide helped you or gave you an idea for your own org, drop a comment or give it a thumbs up! I'm always happy to share more Salesforce tricks with you.

Happy Salesforce-ing!
— Ambrish

Comments

Popular posts from this blog

🔥 Top 10 Adventure Anime to Watch on Crunchyroll in 2025

Ready to level up your watchlist? These action-packed, heart-racing, soul-shaking anime are what every adventure lover needs in their queue. Whether you're into demon slaying, dungeon diving, or street brawling, Crunchyroll’s got the goods — and we’ve got your cheat sheet. Buckle up! ‐-- 1. One Piece Episodes: 1100+ (yes, it’s still going strong 💪) Rating: ⭐ 9.0/10 Alright, let’s talk about One Piece — the king of long-running anime and the beating heart of shonen storytelling. Over 1100 episodes in, and it’s still sailing stronger than ever. Why? Because this isn’t just a story about pirates — it’s about dreams . Luffy, with his straw hat and unbreakable spirit, builds more than a crew — he builds a family . Every island they visit, every enemy they face, every laugh and tear — it all matters. The stakes grow, the world expands, and the bonds only deepen. You’re not just watching an adventure — you’re living it. This is loyalty, freedom, and friendship at its finest. “An unstop...