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
- Log in to your Power Automate account.
- Click on “Create”.
- Choose a trigger. In this scenario, we can select Recurrence and set the flow to run on Mondays every week.
- 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.
2. Retrieve Lead Data
- Add an action to retrieve user data. Use the “List Rows” action and select the User table.
- Using “Advanced Find”, create an Xml Query to filter the User data.
- In this scenario, we want to find Users who own active lead records, and the Modified Date is a week or more.
- In the “Fetch Xml Query” column of the automation, add the query and replace the modified on date with the “Calculated Time” created previously.
- Next, we will need to Initialize a variable. Set the Name column and set Type to “String.”
- 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.”
- 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.
- We will again leverage the Advanced Find functionality to generate a Fetch XML Query for Leads.
- 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.
- 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.
- 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.”
3. Generate the HTML Table
- Add the “Select” action.
- In the “From” input, select value from the List Rows – Leads step.
- Click on “Show advanced options” to customize the table columns. You can choose which fields to include and how they’re described.
4. Styling Your Table
- 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>
- This is what it will look like in our flow.
- Now add the step “Create HTML table”. Populate the “From” column with the output from the “Select” step.
5. Compose Your Email
- Add an action to compose an email and populate the “To” field with the “Outputs” from the “Compose” step.
- In the email body, insert the HTML table Outputs generated previously, along with the Outputs from the “Compose 2 – CSS Styling” step.
- Customize the subject and the body of the email.
- Run the automation and review the result.
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.