Skip to main content

Notifications

Power Automate - General Discussion
Answered

Email Confirmation forced in a loop

(1) ShareShare
ReportReport
Posted on by 19

Hi all,

HindAlmarzooqiP_0-1720687379787.png

i have this flow. My thing is to initiate this whenever a button is clicked in power app and moving forward it should lead to an approval process(which goes to a manager) and i want to send a confirmation that we received the records for the employee who submitted the data.

However, whenever i add an email step it's forces it to in a for each loop which sends the email multiple times depending on the number of records submitted. i want to send it once. I tried to delete the loop and forces it without but I get another error. Any workaround or clear solution?

 

Thank youuuuuuuuuuuuuuuuuuuuu

  • HindAlmarzooqiP Profile Picture
    HindAlmarzooqiP 19 on at
    Re: Email Confirmation forced in a loop

    Hi @Akshansh-Sharma Many thanks!!! appreciate your inputs

  • Verified answer
    Akshansh-Sharma Profile Picture
    Akshansh-Sharma 272 on at
    Re: Email Confirmation forced in a loop

    @HindAlmarzooqiP ,

     

    Can you please implement these steps which will achieve your requirements

     

    1. create a new Trigger Parameter with name "RequestorEmail"
    2. When you are triggring this flow from your app i.e. OnSelect of your button pass this parameter value with the current user email like this FlowName.Run(RequestorEmail:User().Email)​ 
    3. Then use the dynamic content from your trigger and add the RequestorEmail into your To property of your send an email action 

     

     

    This will send an email to the requestor that you received their inputs without the need of Get Items

     

    Let me know how you get on

     

    --------------------------------------------------------------------------------------------------------------------

    Please click Accept as solution if my post helped you solve your issue. If the content was useful in other ways, please consider giving it Thumbs Up 😉

     

    LinkedIn- https://www.linkedin.com/in/akshansharma/

  • HindAlmarzooqiP Profile Picture
    HindAlmarzooqiP 19 on at
    Re: Email Confirmation forced in a loop

    Hi Rob, wow many thanks for the very thorough reply and organization in your response. I appreciate it. I tried to do however my main goal is to just share an email to say that I have received the input. 

  • RobElliott Profile Picture
    RobElliott 9,995 on at
    Re: Email Confirmation forced in a loop

    @HindAlmarzooqiP you will always get an apply to each if you just add the email action after the get items because that action can potentially bring back multiple items from the list and it would need to loop through them.

     

    To get over that and only send a single email you need to use a Select action as follows. In my example I'm getting dates when a user has been in Europe. As you'll see, immediately after the get items is the select with the left field being the column titles I want and the right field being the dynamic content from the list.

     

    After that I added a Create HTML Table action.

    1-Flow.png

     

    I then added a Compose action with css styles because the default html table in Power Automate doesn't have any styling.

     

    In case you want to copy that style it is in the spoiler below. At the bottom of the Compose you select the outputs of the Create HTML Table action.

     

    Spoiler (Highlight to read)
    <style>
    table {
    border: 1px solid #1C6EA4;
    background-color: #EEEEEE;
    width: 75%;
    text-align: left;
    border-collapse: collapse;
    }
    table td, table th {
    border: 1px solid #AAAAAA;
    padding: 3px 2px;
    }
    table tbody td {
    font-size: 13px;
    }
    table thead {
    background: #1C6EA4;
    border-bottom: 2px solid #444444;
    }
    table thead th {
    font-size: 15px;
    font-weight: bold;
    color: #FFFFFF;
    border-left: 2px solid #D0E4F5;
    }
    table thead th:first-child {
    border-left: none;
    }
    </style>
    <style>table {border: 1px solid #1C6EA4;background-color: #EEEEEE;width: 75%;text-align: left;border-collapse: collapse;}table td, table th {border: 1px solid #AAAAAA;padding: 3px 2px;}table tbody td {font-size: 13px;}table thead {background: #1C6EA4;border-bottom: 2px solid #444444;}table thead th {font-size: 15px;font-weight: bold;color: #FFFFFF;border-left: 2px solid #D0E4F5;}table thead th:first-child {border-left: none;}</style>

    2-Flow.png

     

    Then in your email you select the outputs of that formatted table:

     

    3-Flow.png

     

    And this is the result with multiple items from the get items but just in a single email:

     

    4-Email.png

     

    Rob
    Los Gallardos
    Principal Consultant, SharePoint, Forms and Power Platform, WSP Global (and classic 1967 Morris Traveller driver)

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,422

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,711

Leaderboard