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!
Solved! Go to Solution.
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.
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.
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.
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.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.
User | Count |
---|---|
199 | |
97 | |
56 | |
51 | |
41 |
User | Count |
---|---|
265 | |
157 | |
83 | |
80 | |
56 |