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

Create a Flow with Condition that does not send email when list items into an HTML table is empty and another when there are items for table

Hello All!!

 

I am creating a flow that will run daily and traverse through a list looking for items with an upcoming expire date (within the next 30 days). I am then using the create HTML table to add the query items into a single email. I have two emails to send if certain conditions are met. The first sends an email when there are items creating the table and the other email is to run when there are no items up for expiration. I am at a loss on how to do this correctly. This is all too new to me. 

 

Please know I definitely appreciate the help!!!!!!!!!!!!

 

Thanks in advance,

D

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jcook
Super User III
Super User III

Hello @CobraKaiForever 

 

Could you share a screenshot of your flow if my solution does not solve your problem.

 

You can use the expression length() to check the length of your data. In your flow are you putting the data anywhere before you pass it to the HTML table action?

For example, I have a variable with all my data before I pass to HTML table:

Jcook_0-1602887492058.png

Now I can have a condition check the length of my variable:

Jcook_1-1602887576456.png

My expression is:

length(variables('data'))

 

Now you can have two separate send email actions, in the If yes, and If no

 

If you can only have the HTML table to check than you will have to add a 'Compose' action and use the expression length() on the HTML table.

** Note: The HTML table action still has a length when empty, so we must get the length of it when its empty to put inside our condition **

For example:

Jcook_2-1602887894635.png

My expression is:

length(body('Create_HTML_table'))

When I run the Flow when the HTML table is empty, I get a length of 30

Jcook_3-1602887970019.png

 

So now I can build my condition to check if the HTML table length is greater than 30

Jcook_6-1602888259284.png

Expression:

length(body('Create_HTML_table'))

 

 

Empty HTML table = false:

Jcook_4-1602888087624.png

 

HTML table NOT empty = true:

Jcook_5-1602888205893.png

 

 

 

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

2 REPLIES 2
Jcook
Super User III
Super User III

Hello @CobraKaiForever 

 

Could you share a screenshot of your flow if my solution does not solve your problem.

 

You can use the expression length() to check the length of your data. In your flow are you putting the data anywhere before you pass it to the HTML table action?

For example, I have a variable with all my data before I pass to HTML table:

Jcook_0-1602887492058.png

Now I can have a condition check the length of my variable:

Jcook_1-1602887576456.png

My expression is:

length(variables('data'))

 

Now you can have two separate send email actions, in the If yes, and If no

 

If you can only have the HTML table to check than you will have to add a 'Compose' action and use the expression length() on the HTML table.

** Note: The HTML table action still has a length when empty, so we must get the length of it when its empty to put inside our condition **

For example:

Jcook_2-1602887894635.png

My expression is:

length(body('Create_HTML_table'))

When I run the Flow when the HTML table is empty, I get a length of 30

Jcook_3-1602887970019.png

 

So now I can build my condition to check if the HTML table length is greater than 30

Jcook_6-1602888259284.png

Expression:

length(body('Create_HTML_table'))

 

 

Empty HTML table = false:

Jcook_4-1602888087624.png

 

HTML table NOT empty = true:

Jcook_5-1602888205893.png

 

 

 

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

Hello @Jcook 

 

Works perfectly!!! I definitely appreciate the help!! 😊

 

Thanks again,

D

 

 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (1,027)