Use Cases of JavaScript in Salesforce - Change Table Row Colours on the basis of criteria

Use Cases of JavaScript in Salesforce: Change Table Row Colours on the basis of criteria

In the ever-changing technological era, we often come across a new programming language which is being introduced to match the requirements of current problems and ease the life of software developers. Some languages just come by and some leave their essence and make an impact. JavaScript, being one such language, is highly used and preferred when it comes to make web pages or applications interactive and dynamic. It is compatible with almost all modern web browsers without the need for additional plug-ins and can also be used in combination with other back-end languages to create a dynamic UI. Since JavaScript is not a full-fledged programming language it is mostly used with HTML or any other front-end language and has certain limitations. In this series we provide you with some useful code snippets that  might save some time. Below is one such Salesforce JavaScript Use Case.

What does this code do?

Change row color using JavaScript when particular column value is selected. In the below code the row color changes to Red when “Bandwidth” column has value as “Unavailable” and row color changes to Green when Bandwidth column has value other than “Unavailable” and has a date value in “Confirmed” column.

When can it be used?

The function can be used on events like windows Onload or value Onchange, Onblur etc.

Code Snippet:-


Leave a Reply


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2019 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?