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.
@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" } ) )
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