Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Send email with HTML conditional text based on SP list values

(0) ShareShare
ReportReport
Posted on by

Hi all,

 

I'm trying to build a flow which will generate an email based on the values from SP list.

 

The email is using HTML and there are a few bullet point which should be present in the email body or not present based on the value of the respective SP list column. If the value is Yes, show the bullet point text, if the value is not, just not show it at all.

 

My idea was to use something like this (example for SP list column called QA Module):

if(equals(@{triggerOutputs()?['body/field_36/Value']},'Yes','<li>Q&amp;A</li>'))

but that doesn't work.

 

All four SP list column I'm getting the data from are Choice type columns with Yes and No values available.

 

Any idea how should the correct expression look like?

  • xsomej33 Profile Picture
    on at
    Re: Send email with HTML conditional text based on SP list values

    Works great, thanks @Caspar_Rubin!

    Since I have 4 conditions in my solutions, I'm simply appending each of them to the string variable and displaying that variable in the final email.

  • Verified answer
    Caspar_Rubin Profile Picture
    830 on at
    Re: Send email with HTML conditional text based on SP list values

    Hey,

     

    I would create two new variables (action: initialize variable) called something like "HTMLcode" and "EmptyString", both have the type "string" and no content at the moment.

    Then get the SharePoint Items and check if the value in the column is true or not (action: condition with expression "true").

     

    If true, I then add the HTML content to the "HTMLcode" variable. (action: Set Variable")

     

    Then put the variable HTMLcode in the email. Depending on if the value in the list is true or not, there will be content in the "HTMLcode" variable or not.

     

    Don't forget to reset/clean-up the variable after the email is sent. So it's empty again before the next check if you have multiple SharePoint List items looping... This step can be skipped if the flow runs only for 1 SharePoint item.

     

    dependedHTML_2.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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >