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

Yes/No Sharepoint Online Column in HTML Compose action

I'm trying to compose an HTML table whereby two Yes/No fields in Sharepoint will be row shaded(<tr> tag) if one or both is/are Yes (true).

 

My compose input look like this:

if(or(bool(item()?['PicturesReceived']),bool(item()?['Follow_x002d_UpReceivedReceived'])),replace(outputs('Style_th_tag'),'<tr>','<tr style="background-color:#ffc78f;">'),outputs('Style_th_tag'))

4 REPLIES 4
dbro
Super User
Super User

Ron,

 

could you just use column formatting (JSON) for this in the modern sharepoint view?  I think that'd be a lot easier. If you're using classic sharpoint doing the same via JS link on a list view would also be simple.  Perhaps you have a good reason to do this in flow?

 

If you wish to go the html table route in flow I'd:

  1. create a stringvariable (varHTMLTable). set it's value to "";
  2.  Create a condition to check whether your bool == true. if so, set varHTMLTable (with your bg color - <tr style="background-color:#ffc78f;">)
  3.  Else set varHTMLTable (with normal background).

If any of these solutions work, please mark this as answered.

v-bacao-msft
Community Support
Community Support

 

Hi @RonDinoso ,

 

Is this expression valid after running Flow? Are there any errors?

If so, please provide it to us to analyze it.

 

Best Regards,

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

Hi @v-bacao-msft ,

The Flow runs every morning, gets items that were appended or modified within a day's time, builds the HTML table to be emailed.  All of the compose actions use the replace() string function to modify the various tags in the table, but only the "Style tr tag" uses an if statement against two conditions.  The or() operator looks at the two Yes/No columns in my Sharepoint list.  I figured if the value is a Yes in either column, then the or() operatore will return a true.  If the or() function is true, then it modifies the <tr> tag by changing the background-color.

 

The flow works up to the if condition.  I'm thinking don't have have my or() test correct.  Is the Yes/No column in a Sharepoint List treated as a string value in Flow, or a boolean true/false?

 

HTML Flow Code.png

HTML Flow Code 2.png

 

Hi @RonDinoso ,

 

The value returned by Yes/No column is true/false, so you could try to remove the bool() function and directly reference the field value.

 

 

Best Regards,

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

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,667)