Skip to main content

Notifications

Community site session details

Community site session details

Session Id : OfBuCmpy42J0WGYqQ5xA8P
Power Automate - Building Flows
Suggested answer

For a selected row: When no mail were send, how get an alert?

Like (1) ShareShare
ReportReport
Posted on 30 Mar 2025 14:09:15 by 86
I have built a flow with the trigger 'For a selected row'. Multiple attachments are sent, one is a fixed attachment, the other is selected from the excel using a pulldown menu.
Now I want a feedback (via an email, or by writing data to the excel, or something else) that the second attachment wasn't sent because the attachment was forgotten to be selected in the pulldown menu.
 
There are now only 2 files in the Sharepoint folder. In the future this number wil increase.

If an attachment is selected, I will receive an email with 2 attachments and an email that no attachment has been added. Logical, this is because of the 'Apply to each' action for each attechment in the Sharepoint folder.
If I delete the 'Send an email' action from the 'If no' branche, that nothing happen and nobody can see that: the flow will running sussecfully.

So now the question: what if no attachment is selected, while it should have been, how do I get feedback that this went wrong?
 
  • Suggested answer
    Michael E. Gernaey Profile Picture
    37,922 Super User 2025 Season 1 on 31 Mar 2025 at 16:43:16
    For a selected row: When no mail were send, how get an alert?
     
    In my pseudo flow, i didn't add code there I was just putting a step placement. But let me answer inline
     
     
    - Get emails
    ----You have steps in your code for getting the emails, how did you create that before? If this is a ... Static list that only changes not often, then I would put this in an Environment variable, then use the compose to grab the Dynamic Property (from the Environment variable)
    ----So I expected them to be here based on your own steps. 
     
    - Get the file Name from Excel
    ----you had said the file name came from based on what they selected in Excel. I was simply stating this as a step (get the name)
    ----how did you get the file Name before?
     
    - Condition - You can now check if the name is blank
    ----This would have been from the previous step listed above
     
    Happy to help, but I was writing in the steps I would take based on what you said you wanted and needed to do, versus knowing "per se" exactly what goes in them. By that I mean, I do not know how to get the file name from the excel I assumed you did from your existing flow.
     
    But Happy to help as we go along.
  • chosen67 Profile Picture
    86 on 31 Mar 2025 at 07:44:29
    For a selected row: When no mail were send, how get an alert?
    Dear Michael,
    Thanks for your detailed explanation. The way you explain it I think it is the right solution. Because I am just a beginner I do not understand what code you put in the following steps:
    - Get emails
    - Get the file Name from Excel
    - Condition - You can now check if the name is blank
    Would you like to share this with me?
    Thnx a lot!
  • Michael E. Gernaey Profile Picture
    37,922 Super User 2025 Season 1 on 30 Mar 2025 at 21:12:16
    For a selected row: When no mail were send, how get an alert?
     
     
    Thank you for the explanation. one detail was missing but I believe I figured it out from your explanation and pictures. I believe your issue is simply you are iterating through that folder, but it could have a subfolder, which would also get listed, but since its name wouldn't match, you would go to the NO and get a bogus email
     
    If you change it to do the below you should have no issues
     
    Pseudo Steps and Actions
     
    NOTE: I would store the Email Static data Path in an Environment Variable, instead of making calls you do not need since it can be updated if moved. Using the Get Files which is an Array and then using Get File Content (which is odd as how do you know which one returned from the previous array for sure).
     
    Anyway, I would swap that to an Environment Variable and save yourself the cost of those actions.
     
    I would also look at adding environment variables for the 2 folders you were talking about.
     
     
    And here is what my Pseudo one would look like. 
     
    one other note: Your subject asks about GETTING an email notification if there is no file, but your question was how to STOP it from sending you one. SO that was confusing too.
     
    SO trigger
    Get emails
    Get file content with path (for static email attachment)
    Loop through Selected Rows, NOT files in your directory
    Get the name from Excel (or however you do)
    Check if the Name is empty, you could check for null or '' as well, doing a coalesce etc
     
    If its blank (meaning you couldn't figure out a file name) (no side) email about it
    If yes 
    grab the file content for the attachment
    Email
     
    There is no reason to loop the way you are, as it will for sure cause you to get bogus emails for every folder that is there also. Anyway let me know if you have further questions.
     
    If so, please make sure to share more pictures and details.
     
     
     
     
  • ronaldwalcott Profile Picture
    1,878 on 30 Mar 2025 at 19:21:22
    For a selected row: When no mail were send, how get an alert?
    If I am understanding this correctly you could try using "Configure run after", for the particular step, to check for errors and perform the appropriate action
  • chosen67 Profile Picture
    86 on 30 Mar 2025 at 17:18:56
    For a selected row: When no mail were send, how get an alert?
    Dear Michael,
    Thanks for your response and apologies for the confusion, that was of course not the intention. Here is the entire flow with further explanation:
    I start the flow with 'For a selected row'. The Excel is the result of another flow with which students register for an exam. The examination office adds data such as the exam time and exam location etc., and also which preparatory exam assignment must be sent. Which version that is, depends on which exam is requested. This is done with a dropdown menu.
    A fixed attachment that must always be sent are the Examination Rules in the attachment 'Preparation_for_your_exam.pdf'
    Then the email addresses of the examiners are added to the flow (compose actions). Then the content of the attachment 'Preparation_for_your_exam.pdf' is added to the flow.
    In the action 'Condition - 'Spreken of Gesprekken' a first selection is made for these exams, the attachments of which are in a separate folder on Sharepoint. The branch we need is the 'If no'.
    Then a choice is made for the next subject 'Keuzedeel' with attachments in another folder on Sharepoint.
    Then follows the specific exam to which the relevant attachment must be added. Which attachment that is depends on the version of the exam and which cohort the student is in. The attachment that must be is chosen in the Excel file. Multiple lines can be selected simultaneously from the Excel to send, so an Apply to each action must be added to select the correct attachment. (Maybe there is a smarter solution for this?)
     
    Finally, the email is sent with the attachments:
    Attachment 1: the fixed attachment from a fixed location on Sharepoint
    Attachment 2: the attachment for this specific exam
    I hope the flow is clear. So the question is: if no attachment has been selected in the Excel while it should be there (and should also be expected in the branch), how can I build in a feedback?
     
     
     
     
  • Suggested answer
    Michael E. Gernaey Profile Picture
    37,922 Super User 2025 Season 1 on 30 Mar 2025 at 15:12:10
    For a selected row: When no mail were send, how get an alert?
     
    I am a little confused by what you wrote and please provide all the flow because what you said and what you have make no sense.
    You mentioned that the first one is static, so does that mean it will always have the same name?
     
    And why do you have a loop with the Email in it? Don't you want to attach all the attachments then send a single email? You need to use an Array to grab all the email's attachments, then attach that array to the email not this loop.
     
    Based on the flow I see above, I would expect it to only send 1 email because you are comparing the name, and if the second attachment doesn't have that name it would send you an email that there was no second attachment where in fact there was.
     
    The below statement is not logical to me, based on what I can see of your flow. I would expect you to receive a single email, with the "static" attachment, and then 1-Many single emails with no attachments, depending on how many attachments were actually there.
     
    If an attachment is selected, I will receive an email with 2 attachments and an email that no attachment has been added. Logical, this is because of the 'Apply to each' action for each attachment in the SharePoint folder.
     
    Suggestion
    You can add a Condition after your action to get the Files/Attachments, whatever it is you are doing in the step we cannot see.
    Then use the
    length(put your action output body/value or value here)
     
    to check if you only have 1 "attachment/file" or 2.
    If you have 2 here then you did receive your items
    If its 1 here then you didn't and its only the static one and you know to send the email.
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,513 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,636 Most Valuable Professional

Leaderboard