cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
meddlema
Level: Powered On

Question About Formatting an Email

Hello, 

 

I am new to MS Flow and need to know if it possible to format the color of a table/row based on a Yes/No question in a SharePoint list. 

 

What I have is a list with many columns.   One of the columns is "Completed" and is a Yes/No dropdown.   The list has a form that that someone fills out every morning after completing morning system checks.   Once they submit the form I have a flow that sends an email.  I can currently format the data from the list into a table and the table has color. 

 

What I would like to do is have each row either be green or red based on the answer to the "Completed" column.   So if they answer Yes then the table/row is green and if they answer No then table/row is red.  This would need to bent in one email. 

 

Is this possible and if it is how would I need to do this?

 

 

 

7 REPLIES 7
hikmatune
Level: Powered On

Re: Question About Formatting an Email

I think it should be possible, in your flow get list items for each item apply custom style if yes it would be <tr class="green"> if no <tr class="red"> then append them to an array object. Finally use Compose action to create html table and put array object and your sytle should include: 

.green {
background-color: green;
}
.red{
background-color: red;

Hope it make sense 🙂 

Community Support Team
Community Support Team

Re: Question About Formatting an Email

Hi @meddlema,

 

You could refer to this document that learning how to format the value based on the value of the field:

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#conditio...

Please following these steps to find the path to format the Completed column, then past the following JSON code into it, then save it.

Annotation 2019-09-19 134552.png

 

 

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"class": "=if(@currentField == 'Yes', 'sp-field-severity--good', if(@currentField == 'No', 'sp-field-severity--severeWarning', 'sp-field-severity--blocked'))+ ' ms-fontColor-neutralSecondary'"
},
"children": [
{
"elmType": "span",
"txtContent": "@currentField"
}
]
}

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

meddlema
Level: Powered On

Re: Question About Formatting an Email

Hopefully I am on the correct track. 

 

I have done the following:

created a trigger item(When a new item is created)

Get Items (Filtered on todays date)

Initialize a Variable (TableArray)

I have an apply to each based on the outputs of the TableArray

I have set a condition where PhoneCompleted is equal to Ues

If Yes = <tr color="green">,  if No = <tr color="Red">

Appended an Array based on Name: TableArray, Value is Output

Create an HTML Table,  From TableArray.  Created two customer headers.   

Send an email with the body set with Output from the Create HTML Table, HTML is set to Yes

 

The flow is completeing but it is not sending the email. 

 

Here is my flow

Flow 1.PNGFlow2.PNGflow3.PNG

Super User
Super User

Re: Question About Formatting an Email

Hi @meddlema reading through that it sounds like you're on the right lines. What is the output of the TableArray and your Create a HTML Table action when you look at the Flow history? I suspect there's a mismatched HTML tag somewhere that's stopping it from rendering.





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

meddlema
Level: Powered On

Re: Question About Formatting an Email

Unfortunately the results are grayed out and I cannot click on them. 

 

Flow4.PNG

Community Support Team
Community Support Team

Re: Question About Formatting an Email

Hi @meddlema,

 

Please put the Get items value into the Apply to each action.Untitled.png

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

meddlema
Level: Powered On

Re: Question About Formatting an Email

Thank you v-litu-msft.  That worked.  The email is sending.  

 

I have one other issue.   I have added the compose object but I am not sure where the <tr color = "Green> and the <tr color="Red"> should go.  If I put them as an input  the wording shows up in the email.   Does this need to be an expression and if it does what is the correct syntax?

 

I want to thank everyone for their help and patience. I feel like a baby in the woods. I really appreciate it. 

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (5,216)