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 / Help formatting text c...
Power Automate
Unanswered

Help formatting text colour in an email based on SharePoint values

(0) ShareShare
ReportReport
Posted on by 29

Hi Everyone,

 

Please redirect me if this has been answered before...many searches, no luck yet!

 

I have a SharePoint list that I use to formulate emails using Power Automate.

 

What I need to do is have some text change colour/weight based on the values selected from the SP list.

 

An example, I'd like text to show something like this in the body of the email:

- This example is HIGH RISK

- This example is Medium Risk

- This example is Low Risk 

- This example is Adequate and regular

 

I can display this using the switch function using its corresponding PowerApp, and I can conditional format the SP list, but I'm not sure how to do this in the body of an automated email using Power Automate.

Wozza_1-1625710337743.png

I hope that makes sense!

 

Does anyone know of a solution?

 

Kind regards, Wozza

Categories:
I have the same question (0)
  • Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at

    You will need to send the email as HTML, using blocks of text (in variables or compose operations) to construct the email:

    ekarim2020_0-1625761663803.png

    ekarim2020_2-1625761787624.png

    ekarim2020_3-1625762501361.png

    See:  Send Custom HTML Email Notification with Power Automate Outlook Connector 

    Ellis

     

  • Wozza Profile Picture
    29 on at

    Thanks Ellis - I'll take a look and see how I go.

    Much appreciated.

    Wozza

  • Wozza Profile Picture
    29 on at

    Hi Ellis,

    Thank you, but it's not exactly what I was after.

    As suggested, I created a Compose, chose the specific Dynamic Content and tried using an expression to change the colour based on its value. 

    Researching further, it seems that you cannot use expressions to change colour (I think it used to be in the expressions.

    That's a shame. Now, it seems I am limited to 'hardcoding' a colour for the Dynamic Content, rather that being able to have it change colour based on its value.

    ☹️ 

    Does anyone know of a different solution?

    Kind regards, Wozza

  • Verified answer
    fnanfne Profile Picture
    260 on at

    Hey Wozza

     

    I've been looking for a way to do this as well and found a working solution via an HTML table. However, I wanted to get it working within the Send Email V2 action editor itself, here is the code for the expression I used...

     

    if(equals(outputs('Get_item')?['body/Result/Value'],'Fail'),'red','green')
     
    The above is for a SharePoint list colum called "Result". If this field equals "Fail", the text will be shown in red, otherwise, it will appear green.
     
    Below is a flow I made using three different options; using a variable, using the Compose action, and using the Html to text" action, all these work.

     

    Power Automate Flow Help given.png
     
    The code in each of the three options is as follows (this is for one column, in this case, one called "Result")
     

     

     

    <span style="color:@{if(equals(outputs('Get_item')?['body/Result/Value'],'Fail'),'red','green')}">@{outputs('Get_item')?['body/Result/Value']}</span>

     

     

  • Verified answer
    Wozza Profile Picture
    29 on at

    Hi Fnanfne,

    Thanks heaps. I'll check it out.

  • CVannest Profile Picture
    150 on at

    fnanfne,

     

    What if your sharepoint list has 4 options and each option has a color in the list?  I have several columns each with the same set of answers and each color code is the same for the columns (Red/Yellow/Green/Light Red)

     

    On the email, I would like the formatting of those colors to come through so we don't have to attach an auxiliary document.

    Drop Down Options are:
    Red = Observed process not followed

    Yellow = Observed process followed at times

    Green = Observed process always followed

    Light Red = Did not observe

     

    As you can see in the flow, I've created the email format to have 'tables' for the responses under each area.  The responses need to be color coded according to what's in the sharepoint list.

    FlowSample.PNGListColors1.PNGListColors2.PNG

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard