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

Required field validation and sending submission confirmation email

(0) ShareShare
ReportReport
Posted on by

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
    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
    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

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
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard