cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NBates
Level: Powered On

Build a custom flow with multiple criteria and send an email in a specific format.

I am trying to build a flow that is looking for a Sharepoint file with specific information in the File Name.  I am a Novice when it comes to Flows, but am a very quick learner.

 

Below are the bullets of what I am trying to accomplish.

  • Check the Sharepoint folder for a file that has the previous day's date in the file name
    • example:  "File Name - 03-26-19.xlsx"
  • Once found, email to a list of users with the attachment.
    • There are some other sub steps, but they are not necessary at this time.
      • 1:  Send the Excel file with certain columns ommitted from the attachment.
      • 2:  If possible, copy the data out of the Excel file, and paste the data directly into the body of the email.
  • I am also trying to setup a condition that the Flow checks for the file with the previous day's date every morning at 2 AM PST.  If no file found, the flow stops, and checks again the next morning.

With the above information, I was able to build a flow that attaches a file and sends it out, but, I am having trouble getting the flow to check fo rthe specified file, and send out the email with attachment on a nightly basis.

 

I've searched for tutorials to help me with this, but am not finding what I am looking for.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Build a custom flow with multiple criteria and send an email in a specific format.

Hi @NBates ,

 

According to your description, it seems that you would like to send an email with attachment when a file has the previous day’s date in the file name.

 

I have created a flow likes below for your reference.

 

In your scenario, you want to trigger the flow at certain time, then you could use the Recurrence trigger. Here for testing, I am using Button trigger.

 

Get files (properties only) from the library.

 

Add a compose action with the following code to get the file name without extension:

first(split(items('Apply_to_each')?['{FilenameWithExtension}'],'.'))

 

Then add a Condition to check the date in the file name is equal to the previous day’s date.

 

Output

Is equal to

addDays(utcNow(),-1,'MM-dd-yyyy')

 

 

Under if yes branch, add action Get file content.

 

Then send an email with the file attached.

 

Images for your reference:

1.PNG2.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Community Support Team
Community Support Team

Re: Build a custom flow with multiple criteria and send an email in a specific format.

Hi @NBates ,

 

According to your description, it seems that you would like to send an email with attachment when a file has the previous day’s date in the file name.

 

I have created a flow likes below for your reference.

 

In your scenario, you want to trigger the flow at certain time, then you could use the Recurrence trigger. Here for testing, I am using Button trigger.

 

Get files (properties only) from the library.

 

Add a compose action with the following code to get the file name without extension:

first(split(items('Apply_to_each')?['{FilenameWithExtension}'],'.'))

 

Then add a Condition to check the date in the file name is equal to the previous day’s date.

 

Output

Is equal to

addDays(utcNow(),-1,'MM-dd-yyyy')

 

 

Under if yes branch, add action Get file content.

 

Then send an email with the file attached.

 

Images for your reference:

1.PNG2.PNG

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

NBates
Level: Powered On

Re: Build a custom flow with multiple criteria and send an email in a specific format.

Thank you, Mabel.

 

For the most part, this lookis to be doping what I need, but, am running into an error on the Compose Action.

 

The template validation failed: 'The inputs of template action 'Compose' at line '1 and column '2047' is invalid. Action 'Apply_to_each' must be a parent 'foreach' scope of action 'Compose' to be referenced by 'repeatItems' or 'items' functions.'.

Community Support Team
Community Support Team

Re: Build a custom flow with multiple criteria and send an email in a specific format.

Hi @NBates ,

 

Could you show me the function you are using in the Compose action?

Further, a screenshot of the flow would be helpful.

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
NBates
Level: Powered On

Re: Build a custom flow with multiple criteria and send an email in a specific format.

Apologize for the late respnse.  I was able to find my mistake on this one.  the Flow is built now.

 

I have a separate issue with the flow, but will start a new thread to avoid this one from getting convoluted.

Helpful resources

Announcements
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 Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (3,820)