web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Conditional Text Color...
Power Automate
Unanswered

Conditional Text Color in HTML Table

(0) ShareShare
ReportReport
Posted on by 5

I've built a flow that queries a SharePoint List for information, then builds an HTML table and sends a filtered view via email. I'd like to highlight the status fields with different colored font (or cell color) based on what is in these fields (Blocked/No Issues/At Risk).

 

I've watched some videos and tried some if(equals...) coding, but the most recent version results in the font color always being the same (bright green), even though the logic states it should be red. 


The high-level view of my flow is:

- Get Items (filtered list)

- "Select" action to build the table (this is where I've used the following to try the conditional font color)

-  This is the logic I'm using in the fxn below:  if(equals(item()?['OverallStatus']?['Value'], 'Blocked'),'red', 'green')

DeliD_0-1711985949928.png

This is the resulting table:

DeliD_1-1711986009827.png

I plan to use the same logic in the remaining status fields, but am trying to dial it in with Overall first. 

 

Any help would be GREATLY appreciated!

 

Categories:
I have the same question (0)
  • v-mengmli-msft Profile Picture
    on at

    Hi @DeliD ,

     

    From your screenshot, when the value of OverallStatus is Blocked, the expression returns false, please check whether this expression can get the value of OverallStatus.

    item()?['OverallStatus']?['Value']

    Or can you tell me the type of column?

    Could you please show the entire flow?

     

     

    Best regards,

    Rimmon

  • DJ_Jamba Profile Picture
    2,837 Super User 2025 Season 2 on at

    Hi @DeliD 

    HTML formatting in a Select data operation is treated as text.
    In other words, you wouldn't get the actual colour even if you created an HTML table from the Select.

     

    Instead, you would get the following text in the Overall Status column:

    <font color='red'>Blocked</font>

     

    How are you getting an actual colour in the Excel file?

    DJ_Jamba_0-1711990443820.png

    Is there another action after the Select?

     

     

  • DeliD Profile Picture
    5 on at

    Thanks for the responses, I'm adding more details to hopefully help. 

    Here's the overall flow, at least the section in question:

    DeliD_0-1712006245691.png

    I use the output of the Select action as the input and basis to build the HTML table. 

    DeliD_1-1712006407558.png

    Then via a Compose action, I format the table using some modifications to the styling from Ryan MacLean's blog post:

    https://ryanmaclean365.com/2020/01/29/power-automate-html-table-styling/

     

    My thought is that yes, the expression is coming back false, but even if I use orange and purple as the colors, the "Blocked" font still shows up as that bright green in the emailed table.

     

    Thank you for the help!

     

  • DJ_Jamba Profile Picture
    2,837 Super User 2025 Season 2 on at

    @DeliD 

    Can you simply output the value of OverallStatus in the select (no if statements).
    Then I'm guessing your Compose action that's applying the styling after the Create HTML table action, is something like:

    replace(body('Create_HTML_table'),'<table>','<table border=1>')

     ...and maybe more.

     

    Could you post the possible outcomes of OverallStatus and also post the code you have in the Compose that's formatting the HTML table?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard