cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

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
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
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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (25,917)