I have PowerApps form connected to SharePoint list. The form uses various data sources (eg. Cascade drop downs takes info from another lists or excels, there is sharepoint standard drop downs, text fields etc). To save the information we are using Patch() and it works fine, but now we have to have field validation if some required remains empty.
There was idea to use:
OnSave: Set(Submitvar,"SubForm");SubmitForm(SharePointForm1); OnSuccess: Patch() OnFailure: Notify( "Some mandatory fields are not filled in", Error )
Note - submitvar is used to call the Patch() through IF statement.
It works good in showing and highlighting fields with missing info, but it does not sava the information from cascade menues (ignoring Patch).
Is there a way to keep both validation and highlighting of fields in case of error, and save the form via patch (or update Submitted record with patch() data on success)?
Hi @bubuta ,
Could you please share a bit more about your scenario?
Do you want the Patch function (within OnSuccess property of Edit form) to be executed even though the SubmitForm function executes fail?
Based on the needs that you mentioned, I think you have some misunderstanding on the OnSuccess property of the Edit form. The OnSuccess property of the Edit form would be fired when the SubmitForm function executes successfully.
If the SubmitForm function executes fail, the OnSuccess property would not be fired, instad, the OnFailure property would be fired.
If you want the Patch function (within OnSuccess property of Edit form) to be executed even though the SubmitForm function executes fail, please take a try with the following workaround:
Set the OnSave property of SharePointIntegration control to following:
Patch(...) /* <-- Type your Patch function here */
Please take a try with above solution, then check if the issue is solved.
Hello @v-xida-msft ,
Sorry for being slowpoke with my answer 😄 I have tried your code, but it did not work for me.
What magic I did to implement the needed solution:
1. I took out all OnSuccess / OnFailure conditions;
2. I have switched Patch() to Collect() - not really sure if it was required, but i liked Collect() more;
3. I have set variables for the form:
OnVisible = Collect(Collection1, ContractTab); Set(notifwindEID, false);
4. I have created a group of Icons which looks similar to 'Notify' window with error text and Exit button
5. I have set the visibility of the group as follows:
Visible = notifwindEID
6. For 'OnSave' action i have implemented an IF condition, which checks if the field is empty -
If yes - Set(notifwindEID, true);
If not empty - run Collect() function and hide request.
The main minus here is the need to write multiple IF conditions to run validation for required fields. There might be more elegant way of doing this; but so far this is the only solution i could come up with.
Hi @bubuta ,
Yeah, I also agree with the solution you provided. If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Join us on June 28 for our monthly User Group leader call!
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.