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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / For All - Send Email W...
Power Apps
Answered

For All - Send Email With Set Function

(0) ShareShare
ReportReport
Posted on by 78

Good morning/afternoon Power Users,

 

I am having some issues with getting this to work.  I would like to send emails to multiple users using ForAll and Set.  May I please have some guidance on how to correct the script so it will work?  This is my current script: 

 

ForAll(SelectedEmails,


//Retail.
If(varSelectedPPQ.Retail="true", Set(varMdsdApprovalType,"Retail"); Set(varCurrentOwner,varRetailEmail);
Office365Outlook.SendEmailV2("xxxxx@xxxxx.com","MD/SD Retail Review",htmlEmailBody.HtmlText));
//Services.
If(varSelectedPPQ.Services="true", Set(varMdsdApprovalType,"Services"); Set(varCurrentOwner,varServicesEmail);
Office365Outlook.SendEmailV2("xxxxx@xxxxx.com","MD/SD Services Review",htmlEmailBody.HtmlText));
//Food.
If(varSelectedPPQ.Food="true", Set(varMdsdApprovalType,"Food"); Set(varCurrentOwner,varFoodEmail);
Office365Outlook.SendEmailV2("xxxxx@xxxxx.com","MD/SD Food Review",htmlEmailBody.HtmlText));
//Fuel.
If(varSelectedPPQ.Fuel="true", Set(varMdsdApprovalType,"Fuel"); Set(varCurrentOwner,varFuelEmail);
Office365Outlook.SendEmailV2("xxxxx@xxxxx.com","MD/SD Fuel Review",htmlEmailBody.HtmlText));

//FMO

If(varRetailCount + varServicesCount + varFoodCount + varFuelCount = varRetailResponse + varServicesResponse + varFoodResponse + varFuelResponse, true,false);

😞

IF(lbl_CountComparison,true,


Office365Outlook.SendEmailV2 (xxxxx, "FMO Scope Review",

"***** NO WALKER ACTION IS REQUIRED AT THIS TIME *****" & "<br> " &

"Approval Link: " & "https://apps.powerapps.com/play/ xxxxxxx & ppqID=" & InsertedRecord.ID & "<br>" );

Categories:
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @HelpWanted17 ,

     

    Its not available to set a variable in a forAll() loop. 

     

    I think this link will help you a lot:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Set-variable-in-forall/td-p/392072

     

    Best Regards,

    Bof

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard