Having looked through the community, I think this is a really obvious bit of knowledge which I don't have and which highlights my ignorance!! 🙈
I've created a flow that saves attachments with specific words in the name to OneDrive. I'd like them to save with a unique identifier, eg the date. How do I do that?! 😁
Solved! Go to Solution.
Ok, no wonder it didn't work when you didn't have the full video. When I converted the video to a gif, I didn't see the thing that maxed it out at 5 seconds....sorry 😝
Let's try this one.
Ok, so what's happening (I think) is that because there can be multiple attachments to a single email, Power Automate won't let you do a substring on "Name" until you specify exactly WHICH attachment you want to mess with. The fix is to have your flow go through each attachment in what's called an "Apply to Each" loop. Everything you put in this box will get done to each 'thing' on the list. Let's get started:
Immediately after your "When an email arrives" trigger, add the action, "Apply to Each"
In the "Select an Output" part, you will probably only have one option that says "Attachments", use that.
Inside that box, you'll notice 'add an action' to add things inside the loop. Click that and add a Condition (You can also drag the one you made previously into the loop). Now, that you are looking at each individual attachment, you should be able to bring Attachments Name into the condition and add your criteria (contains Risk Assessment, ya?).
Bring all of your Time stuff into the Yes path of the condition (Get the Date, Format the date, Store the Date) and then add another compose for the Suffix and Prefix. For the suffix (remember to click on the Expressions tab), you could probably just paste this in:
And the for the Prefix, see if this works:
Those are both doing the same thing we talked about earlier, but looking at the 'current item' of the Apply to Each loop.
Finally, add in your Create File step (Still inside the yes path, which is also inside the Apply to each loop).
Here's what it should resemble when you're close to done (Ignore the "Scope" thing, that's for another time 😊)
So, pretending there are three attachments on an email - It will go through each one and ask "Does this meet my condition?", If no, it won't do anything. If it does, then for that single attachment, it will do all the things we already talked about...then it will go to the next one.
Anything you wanted to do whether or not the attachment met your condition, you could do outside of the Apply to Each loop.
Fun stuff, right? Good luck, and keep us posted.
I had an almost identical challenge and you provided all the information I needed to adapt an earlier version of my flow to accommodate a change which had been made to the email and attachment(s) now being received.
Awesome community assistance. Thanks again.🙌
Keep up to date with current events and community announcements in the Power Automate community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!