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 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)
  • 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"
     }
     )
    )

     

  • Verified answer
    WarrenBelz Profile Picture
    153,529 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

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 Apps

#1
Kalathiya Profile Picture

Kalathiya 428

#2
WarrenBelz Profile Picture

WarrenBelz 374 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 333 Super User 2025 Season 2

Last 30 days Overall leaderboard