cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dmistry
Level 8

How to skip send email if output from different compose actions are empty

Hi,

 

I have a flow setup as shown in below screenshots. Its working without any issues.

Its a very simple flow with 3 get items, 3 filter array, 3 compose, 3 create html table actions and then send an email out.

 

In the send email body, ishtml is set to YES and I am using custom html to format the content displayed.

 

as shown in last screenshot, outputs from all three compose actions are included in the email body.

One concern I have is, if all 3 compose outputs are empty, it still sends an empty email with custom html text which is but obvious by the current design I created.

 

Is there a way to skip send email only if all 3 compose outputs are empty, maybe a simple condition statment works? Not sure, please share info, thanks in advance. 

 

P.S: I Only want to execute send an email task if either of the compose ouputs contain value.

flow1.JPGflow2.JPGflow3.JPG

3 REPLIES 3
Super User
Super User

Re: How to skip send email if output from different compose actions are empty

@dmistry :

I would approach your requirement a little differently. 

First, I would not use the compose and filter array statements.  Rather, I would use an OData filter on each of the Get Items actions.  That way, only the items you need are returned and there is no need to filter further.

 

To find out if any records were returned, I create an array form the items returned for the Get Items actions and check the length of each one.  Then, you can use a condition to see if you want to send an email.

 

The screen shots below demonstrate the concept of creating the array and checking the length.  The variable I declare is an array.

If you need additonal help, let me know.

 

RecordsReturned.jpgRecordsReturned1.jpg

 

If this answers your question, please mark your post as Solved.

If you like my solution, please give it a Thumbs Up.

 

Scott

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
dmistry
Level 8

Re: How to skip send email if output from different compose actions are empty

Thanks Scott, appreciate the help. I am using odata filter query in my get items and filter array is used for a specific reason. I have to use compose to replace the create html table with a table. There will situations where none of the get items would return anything, that is when I want to skip send email action. Can I use condition for compose output something like not equal to empty?

I am not really concerned about create html action, rather send an email action. Only and only if one of the compose output returns data then email should be sent otherwise skipped.
dmistry
Level 8

Re: How to skip send email if output from different compose actions are empty

@ScottShearer I am trying to do something like below before send an email action.

Capture.PNG

If all 3 outputs are empty then it returns false but when at least one of them is non-empty then also it returns false, how to use this condition here?

Bassically if all 3 are empty then false should be returned but if alt least one is non-empty then true must be returned in which I can attach send an email action, any thoughts how to make it work?

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Speakers, submit your sessions now! Call for speakers ends Feb. 10!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,029)