cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
emfuentes27
Advocate III
Advocate III

Send an email when Yes/No field checked

I'm building an an app that uses SharePoint data, and I need to send an email when a Yes/No field is checked. I added to onCheck the standard:

 

Office365Outlook.SendEmailV2(
    "billgates@microsoft.com",
    "Email Subject",
    "Email Body",
    {
        Cc:"pepe@microsoft.com"
    }
)

It works, and it sends the email when I toggle it to Yes. The issue that when I submit the form, it sends another email. Is there a way to make this one or the other? I really don't care which one.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
StalinPonnusamy
Community Champion
Community Champion

Hi @emfuentes27 

 

The best approach is to send an email after submitting the form successfully. To do that, Remove OnCheck event  code.

  • Submit the form.
  • Set the OnSuccess property of the Form to
If(EditForm1.LastSubmit.BooleanfieldName,
Office365Outlook.SendEmailV2(
    "billgates@microsoft.com",
    "Email Subject",
    "Email Body",
    {
        Cc:"pepe@microsoft.com"
    }
)
)

 

If you not storing the boolean field in Sharepoint then send an email when submitting the form

 

SubmitForm(EditFormName);
If(Controlname.Value,
Office365Outlook.SendEmailV2(
    "billgates@microsoft.com",
    "Email Subject",
    "Email Body",
    {
        Cc:"pepe@microsoft.com"
    }
)
)

 

 

 

 

View solution in original post

1 REPLY 1
StalinPonnusamy
Community Champion
Community Champion

Hi @emfuentes27 

 

The best approach is to send an email after submitting the form successfully. To do that, Remove OnCheck event  code.

  • Submit the form.
  • Set the OnSuccess property of the Form to
If(EditForm1.LastSubmit.BooleanfieldName,
Office365Outlook.SendEmailV2(
    "billgates@microsoft.com",
    "Email Subject",
    "Email Body",
    {
        Cc:"pepe@microsoft.com"
    }
)
)

 

If you not storing the boolean field in Sharepoint then send an email when submitting the form

 

SubmitForm(EditFormName);
If(Controlname.Value,
Office365Outlook.SendEmailV2(
    "billgates@microsoft.com",
    "Email Subject",
    "Email Body",
    {
        Cc:"pepe@microsoft.com"
    }
)
)

 

 

 

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,338)