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 / Mandatory fields not w...
Power Apps
Unanswered

Mandatory fields not working

(0) ShareShare
ReportReport
Posted on by 1,625

Hi

I have a canvas app form linked to SPO, all fields from SPO are not required fields.
On Screen1 I have 2 mandatory fields set from PowerApps and the * shows up next to them, Screen2 I have 1 mandatory field and on Screen3 I have my submit button but no mandatory fields.
I am able to submit my form on Screen3 without any data in the mandatory fields in the previous 2 screens . My submit button code is:

 

UpdateContext(
{
VarPatchedRecord:
Patch(
ListName, Defaults(ListName),
Form1_1.Updates,
Form1_7.Updates,
Form1_2.Updates,
{Column1:Blank()},
{Column1:Blank()},
{Column1:Blank()},

)
}
);
If(Not(IsBlank(VarPatchedRecord.ID)),Navigate(SuccessScreen);
Office365Outlook.SendEmailV2(VarPatchedRecord.ApplicantName.Email, "A new request , "Part B <a href='https://apps.powerapps.com/play/MYURL&Sg=" & VarPatchedRecord.ID & "'> Link to submitted form </a> "))

 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @Lefty 

    What is your question?  I do not see any question in your post.  What specifically do you mean by mandatory fields are not working?

  • Lefty Profile Picture
    1,625 on at

    @mdevaney 

    Apologizes.

    I am able to submit my form  using the submit button, even though I have not entered any data in the mandatory fields. Normally in other forms, it would come up with an error preventing me from submitting 

  • mdevaney Profile Picture
    29,991 Moderator on at

    @Lefty 

    Using PATCH to insert data instead of an Edit Form works a little bit differently as far as required fields go.  You have write some code to check whether all the required information is found in the data to be patched.

     

    Suppose you are writing a new record to a 'Customers' database which should have a CustomerID.  The generic code to check it would look something like this...

     

    If(
     IsBlank(LookUp(your_record_here, CustomerID = Blank())),
     your_patch_code_here,
     your_error_code_here
    )

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Lefty Profile Picture
    1,625 on at

    @mdevaney 

     

    Thanks.

    Does the If statement go outside of the UpdateContext function?

     

    i.e. 

    If(
     IsBlank(LookUp(your_record_here, CustomerID = Blank())),//Also what is meant to go your_record_here, is this my SPO listname? with the CustomerID being the ID field of that list?
    UpdateContext(
    {
    VarPatchedRecord:
    Patch(
    ListName, Defaults(ListName),
    Form1_1.Updates,
    Form1_7.Updates,
    Form1_2.Updates,
    {Column1:Blank()},
    {Column1:Blank()},
    {Column1:Blank()},
    
    )
    }
    );
    If(Not(IsBlank(VarPatchedRecord.ID)),Navigate(SuccessScreen);
    Office365Outlook.SendEmailV2(VarPatchedRecord.ApplicantName.Email, "A new request , "Part B <a href='https://apps.powerapps.com/play/MYURL&Sg=" & VarPatchedRecord.ID & "'> Link to submitted form </a> "))

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 325 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 88 Super User 2026 Season 1

Last 30 days Overall leaderboard