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 / Only Submit If Require...
Power Apps
Unanswered

Only Submit If Required Fields are Filled Out before Sending Emailing and Saving to SharePoint List

(0) ShareShare
ReportReport
Posted on by 28

Hello all,

 

I have a form that sends an email and sends the data from the form to a SharePoint list. But I want to make sure that the user fills out all the required fields before it sends an email and submits to a SharePoint list. I also want the required fields highlighted once they submit so that the user knows which fields are required - but of course make sure that it does not send an email and submits to SharePoint list before all required fields are filled out.

 

I have the code below (form sends email and sends data to SharePoint list, I've omitted the HTML code text which is hidden in the form):

 

Office365Outlook.SendEmailV2(DataCardValue38.Selected.Email,

"Title: " &DataCardValue30.Text

, HtmlText1_2.HtmlText,

{Cc: DataCardValue35.Selected.Email &";"& DataCardValue39.Selected.Email &";"&DataCardValue40.Selected.Email &";"& DataCardValue41.Selected.Email

,Importance: "High"

,Attachments: RenameColumns(DataCardValue42.Attachments,"Value", "ContentBytes" ) }
);




SubmitForm(Form1_2)

ResetForm(Form1_2);
NewForm(Form1_2);

 

Does anyone know how to do this?

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @123testing321 

    Turn off the required property of the columns in the SharePoint list and in your form, set the cards containing those fields to required property true.  The form will do the rest.

  • 123testing321 Profile Picture
    28 on at

    Thanks for the reply.

     

    The data cards that I would like to be required all have Required = True. For example the title card has it on:

    123testing321_1-1672340223786.png

     

    I removed 

    ResetForm(Form1_2);
    NewForm(Form1_2);

    and it actually has that form error now that I'm expecting for required fields. 

     

    But if fill it out with a correct email, it sends an email upon submission even if the required fields are blank. However, it does not send data to the SharePoint list which is the expected result.  Right now, it doesn't matter what I put on the form as long as there is a valid email address, it will automatically sends me an email and not wait for the form to be filled out correctly first. Do you know how to fix this?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @123testing321 

    The SubmitForm() button should not work if the required fields are not filled in and there should be nothing except SubmitForm(Form1_2) on the submit button.  Any other commands should be In the OnSuccess property of the form. This belongs in the OnSuccess property of the form.  It is executing before the OnSubmit()

     

     

    Office365Outlook.SendEmailV2(DataCardValue38.Selected.Email,
    "Title: " &DataCardValue30.Text
    , HtmlText1_2.HtmlText,
    {Cc: DataCardValue35.Selected.Email &";"& DataCardValue39.Selected.Email &";"&DataCardValue40.Selected.Email &";"& DataCardValue41.Selected.Email
    ,Importance: "High"
    ,Attachments: RenameColumns(DataCardValue42.Attachments,"Value", "ContentBytes" ) }
    );

     

     

  • 123testing321 Profile Picture
    28 on at

    Thanks I think I'm getting close but there is now an error on sending email when I click on the submit button with all the required fields filled out:

    123testing321_0-1672350230443.png

     

    123testing321_1-1672350270435.png

    123testing321_2-1672350410380.png

     

    With the code and properties above, it does not send an email anymore but only updates the SharePoint list. I'm not sure what's going wrong 😕

  • 123testing321 Profile Picture
    28 on at

    Also to add, I tried testing it with a static email instead of 

     

    Office365Outlook.SendEmailV2(DataCardValue38.Selected.Email,

    ...

     And the email sent but not with DataCardValue38.Selected.Email

     

    I'm going to try to restart the app because before DataCardValue38.Selected.Email was working. Unless you see any errors on the code that I am missing?

  • 123testing321 Profile Picture
    28 on at

    Restarted but same issues, unfortunately. Just to add as well, I'm dumbfounded by the fact that the CC works which has the same code as TO (e.g. Selected.Email) and I'm selecting the same email I've used for TO with CC but the TO field gives an error. 😕

     

     

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 519 Most Valuable Professional

#2
11manish Profile Picture

11manish 489

#3
Haque Profile Picture

Haque 327

Last 30 days Overall leaderboard