CLOSE
CLOSE
https://www.sikich.com

Using HTML Tables in Power Automate to Display Active Leads that Require Follow-Up

In business workflows, efficient communication and organization are paramount. When dealing with leads, keeping track of follow-up tasks is crucial. In this article, we’ll explore how to leverage Power Automate to create an email notification containing an HTML table that neatly displays active leads that have not been worked on in over a week.

Step-by-Step Guide

1. Create Your Flow

  1. Log in to your Power Automate account.
  2. Click on “Create”.
  3. Choose a trigger. In this scenario, we can select Recurrence and set the flow to run on Mondays every week.
create flow in Power Automate
  1. Next let’s add a “Subtract from time” action and set the Base time to utcNow(), Interval to 7, and Time unit to Day. This will help us filter our data later in the flow.
set recurrence with flow

2. Retrieve Lead Data

  1. Add an action to retrieve user data. Use the “List Rows” action and select the User table.
select User table from List Rows
  1. Using “Advanced Find”, create an Xml Query to filter the User data.
  2. In this scenario, we want to find Users who own active lead records, and the Modified Date is a week or more.
find Users who own active lead records
  1. In the “Fetch Xml Query” column of the automation, add the query and replace the modified on date with the “Calculated Time” created previously.
Fetch XML Query
  1. Next, we will need to Initialize a variable. Set the Name column and set Type to “String.”
initialize a variable
  1. Now we need to generate the list of Active Leads tied to each User that was listed previously. Add a step and select “List Rows” and set the table name to “Leads.”
  2. In the Filter rows column use [_ownerid_value eq ‘User’]. This will adjust the flow and put the List rows step in an “Apply to Each” step.
filter rows column
  1. We will again leverage the Advanced Find functionality to generate a Fetch XML Query for Leads.
list row leads
  1. Next, we will need to get the email from the Lead’s Owning User. Add the step “Get row by id”, select the “User” table, and populate the Row ID with the Owner (Value) from the Lead. This will by default create a “Apply to each” step.
Lead's Owner User email
  1.  Now we need to set the variable within the same “Apply to Each.” Select “Primary Email” from the Get a row by ID – User step.
set variable by primary email
  1. Let’s add a Compose step to store the email we just pulled from the variable. This step will live outside the most recent “Apply to each.”
get a row by ID - set variable - compose email

3. Generate the HTML Table

  1. Add the “Select” action.
  2. In the “From” input, select value from the List Rows – Leads step.
  3. Click on “Show advanced options” to customize the table columns. You can choose which fields to include and how they’re described.
generate the HTML table

4. Styling Your Table

  1.  Now, let’s make our table visually appealing. Add a “Compose” step to our flow and insert the following HTML code:
    <style>
      table {
        font-family: Arial, Helvetica, sans-serif;

        background-color: #EEEEEE;
        border-collapse: collapse;
        width: 100%;
      }
      table td, table th {
        border: 1px solid #ddd;
        padding: 3px;
      }
      table th {
        font-size: 15px;
        font-weight: bold;
        padding-top: 12px;
        padding-bottom: 12px;
        text-align: left;
        background-color: #1C6EA4;
        color: white;
      }
    </style>
  2. This is what it will look like in our flow.
what the HTML will look like in the flow
  1. Now add the step “Create HTML table”. Populate the “From” column with the output from the “Select” step.
create HTML table from output

5. Compose Your Email

  1. Add an action to compose an email and populate the “To” field with the “Outputs” from the “Compose” step.
  2. In the email body, insert the HTML table Outputs generated previously, along with the Outputs from the “Compose 2 – CSS Styling” step.
  3. Customize the subject and the body of the email.
send an email as final step in flow
  1. Run the automation and review the result.
using Power Automate to display active leads

6. Test and Deploy

Test your flow thoroughly to ensure it works as expected. We recommend using “Row Count: 1” on your List Rows steps and setting the email recipient to the User creating the flow. Once satisfied, deploy it to your production environment.

Conclusion

By using HTML tables in Power Automate, you can create professional-looking email notifications that display leads requiring follow-up. Remember to adapt this approach to your specific use case, whether it’s for sales, customer support, or any other business process. If you have any questions about this process, please reach out to us at any time!

This publication contains general information only and Sikich is not, by means of this publication, rendering accounting, business, financial, investment, legal, tax, or any other professional advice or services. This publication is not a substitute for such professional advice or services, nor should you use it as a basis for any decision, action or omission that may affect you or your business. Before making any decision, taking any action or omitting an action that may affect you or your business, you should consult a qualified professional advisor. In addition, this publication may contain certain content generated by an artificial intelligence (AI) language model. You acknowledge that Sikich shall not be responsible for any loss sustained by you or any person who relies on this publication.

About the Author