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

SharePoint "Customize List" with Patch - Issues with Save and Required Fields

I'm working on a Power App that someone else set up.  SharePoint list is the data source.  Patch function used. 

 

SharePoint Integration OnSave = 

 

If(
MainForm.Mode = New,
Set(varFlag,"1");
Patch(
'Project and Initiatives Control',
Defaults('Project and Initiatives Control'),
MainForm.Updates,
AddInfoForm.Updates,
StatusForm.Updates
),
Set(varFlag,"1");
Patch(
'Project and Initiatives Control',
{ID: SharePointIntegration.SelectedListItemID},
MainForm.Updates,
AddInfoForm.Updates,
StatusForm.Updates
)
);

 

With this set as-is, it shows errors for Required fields that are empty.  But, when click Save, the screen remains and doesn't close or go back to the list. 

 

If I add RequestHide() it saves and closes, but doesn't present errors for Required fields. 

 

How to fix?  Need to keep Patch, but also need errors for required fields and need the form to close/go back to list. 

 

TIA!

1 ACCEPTED SOLUTION

Accepted Solutions

@scnative ,

Why don't you just put a SubmitForm on a button on each form?

SharePointIntegration was never designed to do what you are attempting. If you do them one at a time, any required fields will be flagged. Also, have you tried the suggestion I made to look for blank fields before submitting the code?

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

10 REPLIES 10
WarrenBelz
Super User III
Super User III

Hi @scnative ,

From my understanding required fields are triggered generally by SubmitForm or in the case of a new record using Patch, the data simply will not save to the data source. The problem with using the integrated save is that it was not (I believe) ever designed to perform this level of modification.

One solution would be to code in the required fields before the Patch

If(
   IsBlank(ControlValue),
   Notify("Field is required"),
   Patch . . . .
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz - so theoretically, if I create a button to submitform, it would achieve what I want?

Hi @scnative ,

That is what the Standard "out of the box" OnSave event in SharePointIntegration does and yes, SubmitForm takes care of required fields and if the control is left standard, it also displays the error.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

@WarrenBelz - sorry, I mean given the current Patch scenario, using a SubmitForm button at the bottom of the screen would achieve it?

I tried SubmitForm button and it closes the form if I add RequestHide(), but doesn't prompt for required fields.  This is very frustrating. 

@scnative ,

Why don't you just put a SubmitForm on a button on each form?

SharePointIntegration was never designed to do what you are attempting. If you do them one at a time, any required fields will be flagged. Also, have you tried the suggestion I made to look for blank fields before submitting the code?

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Hi @scnative ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz, I haven't yet tried the check for blank fields yet because we have over 60 fields and it seems a bit clunky to create code to individually check all 60 fields. 

HI @scnative ,

Maybe you should consider using SubmitForm() on them individually before moving off them - it would than all work. There is really no other solution than these two.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,471)