How to Add Icon and Style Conditionally on Records in Salesforce Lightning DataTable Component (Aura)?

Today, in this solution, we will create a component that displays an icon and text color for Salesforce records based on some conditions in aura using the Salesforce lightning data table.

In this solution, we have signified records based on the colors- if the account record is Active, then that row represents the color green and shows the utility check icon. If it is not active, then it is in the color red. Now, let’s see how we developed the component using the data table!

Let’s start!

Code

Output

Conclusion

There you have it! Wasn’t it the easiest solution for creating a component that displays an icon and text color for Salesforce records ever? We hope that you not only liked the solution but will also implement it for your Salesforce org. Do share your valuable feedback with us if you try it out. Also, if you need further help or assistance in implementing Salesforce solutions, then our experts can help. Get in touch with us. We’ll be back soon. Till then, happy learning! 🙂

Our Location worldwide
India
3rd Floor, A-10, Pegasus Tower, Sector 68, Noida, Uttar Pradesh 201301 +91-1203117884
SR Tower 2nd Floor Hydel Gate Haldwani Uttarakhand 263126 +91-5946359996
USA
333 West Brown Deer Road Unit G – 366 Milwaukee WI, USA 53217 +1(262) 310-7818
UK
7 Bell Yard, London, WC2A 2JR +44 20 3239 9428
Canada
HIC Global Solutions INC
43 Lafferty Lane, Richmond Hill, L4C 3N8, CA +1(262) 310-7818