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 / Required field validat...
Power Apps
Answered

Required field validation and sending submission confirmation email

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

I need some help on the form validation and sending a notification email.

 

I have created a form using SharePoint list as a data source. There are few mandatory fields which want to validate on the submit button. Using the first part of the code, I am able to validate and submission happens only when all the required fields are filled. However, after adding logic for email notification, I get notification email though fields are blanks. How do I restrict my email notification on the submit button and make sure email is sent only when all the mandatory fields are filled? Quick response is appreciated. 

 

 

If(
!Form1.Valid,
// Then
SubmitForm(Form1),
// Else
If(
IsEmpty(DataCardValue1),
// Then
Notify(
"Failed to submit, fill all required fields and try again.",
NotificationType.Error
),
// Else
ResetForm(Form1);
ResetForm(Form1);
Navigate('Thank you');
Notify(
"Submitted new record.",
NotificationType.Success
);
);

);
Office365.SendEmail(
"abc@xyz.com",
"EPO Intake Form - Submission Confirmation : " & DataCardValue1.Text & " Plot " & DataCardValue1.Text & " : " & User().FullName,
"Hi <b></b>" & Left(
User().FullName,
Find(
" ",
User().FullName
) - 1
) & "," & " <br><br>
Thank you for your submission." & "<br><br><b></b>" & "We will review and respond no later than two (2) business Days. <br><b> <b></b></b>" & " <br> Please feel free to reach out to abc@xyz.com if you have Any questions.<b></b><br>" & "<br>Thanks!",
{
IsHtml: true,
Importance: "Normal",
Cc: User().Email
}
)

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous 

     

    Use a context variable and set the value to false by default

     

    UpdateContext({ FORMVALID: false })

    Update this variable to true only when validation is successful or based on your business criteria.

     

    Thanks.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

     

    oops...

     

    and the check

     

    If(FORMVALID, Office365.SendEmail(...))

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard