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 / Outlook Connector - Na...
Power Apps
Answered

Outlook Connector - Navigate Home ONLY if email sent successfully

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, I am using the Outlook Connector Send Email action to send an email. Within the onSubmit action, the email is sent, then the item is updated, and the user is navigated back home. The issue is that if the email fails to send, the item is still updated, and user is navigated back home. Is there some type of code/function I could add to only do the other two items if the email sent successfully? So wondering if there is a IsValid or send equals to true or something? 

 

Here's my formula that I am currently using. 

 

Office365Outlook.SendEmail(To_TI.Text,Subject_TI.Text,EmailBody_HTML.HtmlText,{Bcc:BCC_TI.Text,Cc:CC_TI.Text,From:From_TI.Text,Importance:"Normal",IsHtml:true,ReplyTo:"email@address.com"}); Patch(DATASOURCE,LookUp(DATASOURCE,ID =Gallery.Selected.ID),{Datasource Column:"Value"})
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    154,447 Most Valuable Professional on at

    Hi @Melinda ,

    Try this

    UpdateContext({varEmailErr: false});
    IfError(
     Office365Outlook.SendEmail(
     To_TI.Text,
     Subject_TI.Text,
     EmailBody_HTML.HtmlText,
     {
     Bcc: BCC_TI.Text,
     Cc: CC_TI.Text,
     From: From_TI.Text,
     Importance: "Normal",
     IsHtml: true,
     ReplyTo: "email@address.com"
     }
     ),
     UpdateContext({varEmailErr: true})
    );
    If(
     !varEmailErr,
     Patch(
     DATASOURCE,
     {
     ID: Gallery.Selected.ID,
     Datasource Column: "Value"
     }
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Melinda Profile Picture
    Microsoft Employee on at

    @WarrenBelz that worked perfectly! Only required change was updating the semicolon to a comma before the second if statement. I marked it below in the code you provided. 

     

    UpdateContext({varEmailErr: false});
    IfError(
     Office365Outlook.SendEmail(
     To_TI.Text,
     Subject_TI.Text,
     EmailBody_HTML.HtmlText,
     {
     Bcc: BCC_TI.Text,
     Cc: CC_TI.Text,
     From: From_TI.Text,
     Importance: "Normal",
     IsHtml: true,
     ReplyTo: "email@address.com"
     }
     ),
     UpdateContext({varEmailErr: true})
    );
    If(
     !varEmailErr,
     Patch(
     DATASOURCE,
     {
     ID: Gallery.Selected.ID,
     Datasource Column: "Value"
     }
     )
    )

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard