I need to automatically send out monthly report emails with multiple attachments to each of our clients.
So my flow references an excel table with two columns, client name and client email address. Based on the client name, It then searches the monthly reports onedrive folder for the matching folder name (which is the client name) , gathers all files in that folder, and puts them in an array. Then it sends out an email with the monthly reports to each client email address listed in the second column of the excel table.
Everything is working fine except it attaches every file from every folder and sends them to every client. I only need each client to receive their client-specific files stored in the onedrive folders labeled as their name.
Is their some way to make the array reset and loop to get new attachments? Or do I need to have a different array for each client? I have researched this endlessly and since my case is very specific have had trouble finding answers. Any help is appreciated.
I had to put in this condition because the flow kept failing with a 404 error because the find files in folder step above listed the folders as a file, so the get file content step below didn't recognize it as a file
You need to reset the array after each run as it will just keep adding the files. The way I do it is to initialise a second array variable. After I build the array I send the email to the client, then I reset the array to equal the second array which is blank. the for each runs again and redoes the process. This means you need to find a way in the process to run your email each time the list of attachments is completed. Given your first Apply to each, it needs to be inside that as I assume it now has one client that is matching, so steps would be
hi @Ventit Apply to each means you will loop one by one all values inside your Sharepoint List. If you want to avoid that don't use excel values from excel.
Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.