The outcome of the condition is always false.
Essentially this is a Microsoft form that all the outcomes of the form go to a excel table. the form number is used to communicate across business suppliers, and is always within the subject of an email chain for one department of the company.
i am trying to extract attachments from emails containing the specific form number and place them into a folder that is named the form number. (This already works - i have a folder automatic creation working).
Help Please?
Thanks for this reponse.
I have about 500 form numbers, so 5000 is plenty. this is great....however, i think it will create a folder for every single form number every time an email has arrived, because its not in a loop? this means that it takes over 15 minutes to run.
How many rows do you currently have in your Excel Table? List rows present in a table will only return up to 256 rows by default. If you have more than 256 rows, you would need to change it to allow more. I've rebuilt the flow how I would achieve this, so it avoids the looping and condition within each iteration.
For this example, I'm using the following Excel Table. It just contains a list of Form numbers.
See full flow below. I'll go into each of the actions.
When a new email arrives would be setup as below. This would be your Shared mailbox trigger.
List rows present in a table would retrieve the Excel Table data. If you have more than 256 rows, then you can set the Top Count to a max of 5000 so it will return up to 5000 items. If you had more than 5000 items, then let me know and we can add Pagination and a Threshold to get more if required.
Filter array will filter out the data, so it only returns items where the Subject contains the Form Number. If no matches, then we would get nothing returned. However, if at least one match, then we would get data returned.
If there is a match, then we expect there to be 1 result. Condition checks the length of the Filter array to determine if any matches. If there are, then we go into the Yes branch and continue. We would use the following expression.
length(body('Filter_array'))
Apply to each will iterate over each of the attachments from the email and use Create file to create a file for each one using the Attachments Content. For Folder Path I would use the following expression to build up the path including the Folder with the name of the current Form Number that was matched. If the folder doesn't already exist, it will be created automatically.
//Folder Path
//You would replace /Shared Documents/Assorted Files/ with your base path
concat('/Shared Documents/Assorted Files/', first(body('Filter_array'))?['Form Number'])
If we sent an email where the Subject contained 'Form 1' and had three attachments, we would get the following output.
Anyone?
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional