web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Workaround for "Termin...
Power Automate
Answered

Workaround for "Terminate" limitation inside "Apply to each"

(0) ShareShare
ReportReport
Posted on by 24

Hello everyone. We are trying to use attachment content from the list and pass it for approval. Would like to terminate the flow and send email if the content (approval) rejected. Seems like "Terminate" is not available in inside the Apply to each function. We did not specifically select "Apply to each", it was auto populated. Any available workarounds to achieve the goal?

 

stpa_0-1706330901352.png

 

Thank you!

 

Categories:
I have the same question (0)
  • harshdeol Profile Picture
    441 Moderator on at

    Hi @stpa ,

    The goal is to send an email if the approval is rejected, correct?

     

    >>To achieve this, In the Condition's "If no" section, add only the "Send an email (V2)" action.

    If the Approval Outcome is Rejected, the flow will send an email and end the flow if there is no action configured after that. (Terminate is not necessary here in this case.)

    harshdeol_0-1706336601590.png

     

     

     

    Additionally, the "Apply to each" was added automatically as the "Get Attachments" returns the data in an array (because it may be possible that the list item contains more than one attachment).

    If there are more than one attachment, this flow will create one approval for each attachment. If you want to send one approval for all the attachments of an item, please Append all attachments in an array and pass it to Approval.

     

    Try it and let me know if you need further assistance.

    -------------------------------------------------------------------------------------------------------------------------
    If your question got an answer, please click "Accept as Solution "✅, If you liked my answer, please hit the "thumbs-up" 👍button.

    Thank you,
    Harsh Deol

  • stpa Profile Picture
    24 on at

    Thanks. The screenshot does not show it, but there are many flow steps after it. 

  • stpa Profile Picture
    24 on at

    stpa_0-1706366304407.png

     

  • Verified answer
    harshdeol Profile Picture
    441 Moderator on at

    Hi @stpa ,

    Then, do one thing: initialize a string variable at the beginning of the flow and set the variable to "Terminate" in the "If no" section of the condition after sending an email (V2) action.

     

    After that, outside the "Apply to each" loop and before the "Update Status - Pending Finance Approval" action, add one more condition to check if the variable is equal to "Terminate."

    >> If yes, use the Terminate action to end the flow.

    >> Otherwise, it will proceed to the "If no" side where you can move all other Actions of the flow, including "Update Status - Pending Finance Approval."

     

    Please refer to image below:

    harshdeol_0-1706367781454.png

     

     

    -------------------------------------------------------------------------------------------------------------------------
    If your question got an answer, please click "Accept as Solution "✅, If you liked my answer, please hit the "thumbs-up" 👍button.

    Thank you,
    Harsh Deol

  • eliotcole Profile Picture
    4,363 Moderator on at

    Perhaps in addition to Harsh Deol's suggestion you could swap the Apply to each / For each with a Do until / Until action, and setup a boolean variable to decide when it is done, and then when the VarTerminate is true also set the additional boolean to true to stop the Do until. (or use an 'or' condition for the do until)

  • stpa Profile Picture
    24 on at

    This is great and it did solve our problem. Thank you very much for your help!!

  • harshdeol Profile Picture
    441 Moderator on at

    You're welcome @stpa.
    Happy to help 🙂

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard