cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PnikX
Frequent Visitor

Send email with HTML table highlighting cell values based on dynamic content

Hi All,

 

Using flow I am trying to send an email with a HTML table that has 2 columns

Field Name and its Has Column Changed Value (True/False) 

 

The html along with the script to highlight the table content is available in : Tryit Editor v3.6 (w3schools.com)

 

html editor.JPG

 

However the same when I add inside the "Send email V2" is not highlighting the table values.

 

No Highlight in email.JPG

 

Screenshot of the HTML in flow:

 

Style.JPG

 

Script.JPG

 

Is the script not accepted in Send email V2?

 

Thanks in advance for any help on this issue 🙂

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
DamoBird365
Super User
Super User

Hi @PnikX 


In that case could you use the if expression. If(equals(Has Column Changed Value,’yes’), htmlwithhighlight, htmlwithouthighlight)

 

Damien

View solution in original post

8 REPLIES 8
DamoBird365
Super User
Super User

Hi @PnikX 

 

I don't know why your script isn't working but html has a tag method for highlighting text which works and I have tested in Outlook.

 

DamoBird365_0-1615662625885.png

 

DamoBird365_1-1615662637335.png

 

<p style="background-color: #86aba5">This text is highlighted</p>

 

Give that a go, a lot simpler I think.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien

 

Hi Damien,

 

Thank you for replying to my request.

 

The Tag method you have suggested is useful for fixed text / sentence in an email.

 

However, in my case, the "True" / "False" text is not fixed.

 

It is the output of Dynamic content "Has Column Changed Value: <<column name>>"  and they keep changing in every email triggered whenever a SharePoint Item is modified.

 

So html tag method is not helping.

 

 

Thanks  again for your reply!

 

DamoBird365
Super User
Super User

Hi @PnikX 


In that case could you use the if expression. If(equals(Has Column Changed Value,’yes’), htmlwithhighlight, htmlwithouthighlight)

 

Damien

I tried creating an if expression in many ways but kept failing with

 

Invalid.JPG

 

IF tried these..

 

if(equals(outputs('Get_changes_for_an_item_or_a_file_(properties_only)')?['body/ColumnHasChanged/Short_x0020_Description']),<p style="background-color: #FFE4C4">modified</p>,<p style="background-color: #F0FFFF"> - </p>)

 

AND

 

if(equals(outputs('Get_changes_for_an_item_or_a_file_(properties_only)')?['body/ColumnHasChanged/Short_x0020_Description']), 'True',<p style="background-color: #FFE4C4">modified</p>,<p style="background-color: #F0FFFF"> - </p>)

 

AND

 

if(outputs('Get_changes_for_an_item_or_a_file_(properties_only)')?['body/ColumnHasChanged/Short_x0020_Description']) = "True",<p style="background-color: #FFE4C4">modified</p>,<p style="background-color: #F0FFFF"> - </p>)

 

without "= "True""

-----------------------

 

if(outputs('Get_changes_for_an_item_or_a_file_(properties_only)')?['body/ColumnHasChanged/Short_x0020_Description']),<p style="background-color: #FFE4C4">modified</p>,<p style="background-color: #F0FFFF"> - </p>)

 

I agree it would have been a simpler method than the script if I was accomplish this with if expression!!

You are awesome!!!

I knew that my expression syntax was wrong and also that your suggestion will surely work if i got it right.

(As you would have guessed by now.. I am new to this  🙂 ) after many trial and errors.. got the expression right!

 

 

if(equals(outputs('Get_changes_for_an_item_or_a_file_(properties_only)')?['body/ColumnHasChanged/Short_x0020_Description'], True), '<p style="background-color: #FFE4C4">modified</p>','<p style="background-color: #F0FFFF"> - </p>')  

 

 

PnikX
Frequent Visitor

Hi Damien, 

 

Here's the final result that I was looking for.. I can now add as many fields and their status in my flow email!

 

FinalResultJPG.JPG

 

Thanks a ton for your guidance!!!

 

 

 

DamoBird365
Super User
Super User

Hey @PnikX  - no problem.  Glad it worked for you.  😀

PnikX,

 

Could you share where you put the "If" statement in the body of your email in the flow?
I have a large email that's created with the results of a survey.  I want the cell highlighted a certain color based on the value retrieved from Sharepoint.

 

The VALUE has 4 possible selections.  In the SharePoint list each value has it's own color.  I need to get that color into the email so reviewers can easily see which ones are not GREEN (Good).

 

An example of what I have now is this:

 

</p>
</br></br>
<b>STORE VISIT SUMMARY:</b></br></br>
@{triggerBody()?['OtherNotes']}</br>
<b>OBSERVATION SUMMARY</b></br></br>
<table class="tg">
<thead>
  <tr>
    <th class="tg-tc7w" colspan="2">SALES DEPARTMENT</th>
  </tr>
</thead>
<tbody>
  <tr>
    <td class="tg-0lax"><b>Team Members Wearing Name Tags</b></td>
    <td class="tg-0lax">@{triggerBody()?['ServiceTeamMembersWearingNameTag']?['Value']}</td>
  </tr>
  <tr>
    <td class="tg-0lax"><b>Team Members Wearing Masks Properly</b></td>
    <td class="tg-0lax">@{triggerBody()?['ServiceTeamMembersWearingMasksPr']?['Value']}</td>
  </tr>
  <tr>
    <td class="tg-0lax"><b>Team Members in Compliance with Dealership Dress Code</b></td>
    <td class="tg-0lax">@{triggerBody()?['ServiceTeamMembersinCompliancewi']?['Value']}</td>
  </tr>
  <tr>

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (3,756)