cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Sharepoint List with Patch missing required fields.

I am trying to build an app without using the datacards. So I have multiple inputs, and a patch function to submit them. However, when I try to submit the info I get "Some" errors that are missing because they are required. From 10 required columns when I look at the errors after doing the patch, I only see that 3 of my columns are actually required. When I look at the sharepoint list, the created record shows the newly added record but with warnings over the missing required information. Im not sure if this is an issue of using a sharepoint list that has required fields, but I cant find any information on how to make my inputs required AND for the inputs to actually populate the errors table when they are missing information.

This is how I am looking at the errors table:

UpdateContext({ErrorsContext:Concat(Errors('MyTable'),Message & Char(13) )});

ErrorLabel.Text = ErrorsContext

 

My sharepoint list complains about these fields missing, but the patch didnt show them as errors.... so the update goes thru:

CompleteWithErrors.png

 

Is there any way to make the fields required? or any way to manually add errors to the errors table? or to make sharepoint lists required columns actually be required?

19 REPLIES 19
Highlighted

Have you considered, if you would like to show your users the errors, attaching an if statement to your submit button? Something like below should work

If(or(isblank(a),isblank(b) etc),set(errorview,true),patch)

Then have a small label below each required input that in visibility says errorview
And in text says if(isblank(a),"Required Field","")

That could circumvent the req for checking in sp first
Highlighted

This is what im currently doing, however I was hoping the sharepoint list definition would do that automatically instead of me having spaghetti code all over the place for my 20 inputs.

Highlighted

@LuisTorresYah sorry, I do not think it is possible to stop the patch without writing that behavior into your button itself. Searched for a bit here just to be sure I hadn't missed something but nada.

Something you might want to do, add this into the button press if statement for when information has been left out

 

Notify( "Hello, World", NotificationType.Error )

 

That will allow you to have an error message pop up across the top of the screen for the user to simulate powerapps own error handling!

Highlighted

Thought of a way you could this on the button alone but the coding would be a bit more complicated.

On select of button you will need to form a collection of status of those fields

Something like

Clear(checks);
if( isempty(a), collect(checks,"a");
If(isempty(b), collect(checks,"b");
Etc

Then you can concatenate all the items in cour collection with " & " and store them as a variable

Then run an if statement to either check if the collection is empty or if your variable is blank etc and if it is give that error message i showed in previous post except make the error message something like "please fill required fields "&yourcreatedvariable, otherwose run the patch

Using this method you wouldnt need to do the code all over your app but in one place as you wanted

Highlighted

This is what im currently using for all my inputs:

If(IsBlank(DepartmentInput.Text),Collect(Errors('MyDataSource'),{Message:"Department field is required",Error:2}));

And after that I do this:

UpdateContext({ErrorsContext:Concat(Errors('MyDataSource'),Message & Char(13) )});

 Then I have an error label:

ErrorLabel.Text = ErrorsContext

 and of course the context is deleted when rerunning the checks.

 

 

This has been working so far, but I was hoping for a cleaner solution.... seems like the sharepoint lists required texts are behaving weird.

Highlighted

Sharepoint, at least as long as I have used PowerApps, has never kicked back patches if they were missing a required field, just leaves it blank with the error showing on the SharePoint field. Combed through a lot of people asking the question in last hour or so just to check the history on it, but have found no instance in which anyone gave a way to correct that behavior OUTSIDE of coding the error check into your button or Using an ////EDIT FORM/// instead of custom building your page from scratch. The edit form will handle checks for required fields

Highlighted

Here's how it looks when using an edit form
Capture2.PNG

Highlighted

Actually im doing it from scratch, because of some styling requirements I have. Not really to fix the issue. I know its easier with the datacards...I actually had a version of the same app that used those. However making it from scratch is quite the learning process.

Highlighted

Yah then, unfortunately, you will have to continue checking manually as currently constructed. Maybe suggest this is as a future feature in the ideas forum?

Highlighted
Resolver I
Resolver I

Hi,

I recently have the same issue. I think I resolved it removing the Sharepoint List Connection, reseting Powerapps Studio and add it again. Then, obviously, I republished the app, and I cannoted replicate the error again.

 

Note: 

My app was working fine until I configure a Sharepoint List Field to be required.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,693)