I use a patch process to submit multiple forms to the same sharepoint list. It works Great! One problem i have is that when I patch, I navigate back to the new screen. If there is an error in the patch, (Required field not chosen) the form navigates away from the page anyway. How can I get it to stay on the page if there is an error, even if I am using navigate in the patch process?
Solved! Go to Solution.
Hi @Roberts2727,
Do you want not to navigate to another screen when there is error with the Patch function within your app?
If you don't want to navigate to another screen when there is error with the Patch function within your app, I think the Errors function could achieve your needs.
I have made a test on my side, please take a try with the following workaround:
Note: I don't provide a value for the Title column, which is a Required/mandatory fild in my SP list.
Set the OnSelect proeprty of the "Vote" button to following formula:
If( IsEmpty(
Errors(
'20181010_case4', /* <-- 20181010_case4 represents my SP list data source */
Patch('20181010_case4',Defaults('20181010_case4'),{Visitors_x0020_Name:"Steven Liu",Company:"SunShine",Checkin_x0020_DateTime:Now()})
)
), Navigate(NoErrorScreen,ScreenTransition.Cover), Navigate(HasErrorScreen,ScreenTransition.Fade) )
On your side, you should type the following fomula within the "Submit" button:
If( IsEmpty(
Errors(
'YourSPList', /* <-- 20181010_case4 represents my SP list data source */
Patch(
'YourSPList',
Defaults('YourSPList'),
{
Column1: "xxx",
Column2: "xxxx",
Column3: "xxx",
...
}
)
)
), Navigate(AnotherScreen,ScreenTransition.Cover) )
The GIF screenshot as below:
In addition, you could also take a try with the following formula within the OnSelect property of the "Submit" button:
Patch( 'YourSPList', Defaults('YourSPList'), { Column1: "xxx", Column2: "xxxx", Column3: "xxx", ... } ); If(
IsEmpty(Errors('YourSPList')),
Navigate(AnotherScreen,ScreenTransition.Cover)
)
More details about the Errors function in PowerApps, please check the following article:
Best regards,
Kris
Hi @Roberts2727,
Do you want not to navigate to another screen when there is error with the Patch function within your app?
If you don't want to navigate to another screen when there is error with the Patch function within your app, I think the Errors function could achieve your needs.
I have made a test on my side, please take a try with the following workaround:
Note: I don't provide a value for the Title column, which is a Required/mandatory fild in my SP list.
Set the OnSelect proeprty of the "Vote" button to following formula:
If( IsEmpty(
Errors(
'20181010_case4', /* <-- 20181010_case4 represents my SP list data source */
Patch('20181010_case4',Defaults('20181010_case4'),{Visitors_x0020_Name:"Steven Liu",Company:"SunShine",Checkin_x0020_DateTime:Now()})
)
), Navigate(NoErrorScreen,ScreenTransition.Cover), Navigate(HasErrorScreen,ScreenTransition.Fade) )
On your side, you should type the following fomula within the "Submit" button:
If( IsEmpty(
Errors(
'YourSPList', /* <-- 20181010_case4 represents my SP list data source */
Patch(
'YourSPList',
Defaults('YourSPList'),
{
Column1: "xxx",
Column2: "xxxx",
Column3: "xxx",
...
}
)
)
), Navigate(AnotherScreen,ScreenTransition.Cover) )
The GIF screenshot as below:
In addition, you could also take a try with the following formula within the OnSelect property of the "Submit" button:
Patch( 'YourSPList', Defaults('YourSPList'), { Column1: "xxx", Column2: "xxxx", Column3: "xxx", ... } ); If(
IsEmpty(Errors('YourSPList')),
Navigate(AnotherScreen,ScreenTransition.Cover)
)
More details about the Errors function in PowerApps, please check the following article:
Best regards,
Kris
I have tried both methods you propose with out success. Although I see the red banner throwing the error, I still navigate to the welcome screen.
below is my patch
If( IsEmpty( Errors( ResearchApp, Patch(ResearchApp, Defaults(ResearchApp),{Form2.Updates, Form3.Updates, Form3_1.Updates, Form3_2.Updates, Form3_3.Updates, Form3_4.Updates}) ) ), Navigate(Welcome, ScreenTransition.Fade))
Error with navigation back to welcome screen:
Thank you so much for your assistance.
Hi @Roberts2727,
Could you please share your app with me?
I have made a test on my side, and don't have the issue that you mentioned.
Please take a try to re-create your app, then check if the issue is solved.
Best regards,
Kris
Ohh I got it! I removed the curly brackets around my forms and reformatted for readability.
If( IsEmpty( Errors( ResearchApp, Patch( ResearchApp, Defaults(ResearchApp), Form2.Updates, Form3.Updates, Form3_1.Updates, Form3_2.Updates, Form3_3.Updates, Form3_4.Updates ) ) ), Navigate(Welcome, ScreenTransition.Fade) )
You are amazing Kris!
Hi @v-xida-msft and @Roberts2727
I'm trying to implement you solution with my case, which is :
If patch return a records, means journal counting line was updated. End of the process (use Error function to have patch return value),
If no record returned, mean you need to create journal counting line, so patch again with Default (using patch default as else expression)
And i'm trying with this code below, and it doesnt work:
If(
IsEmpty(
Errors(InventoryCountingJournalLines,
ForAll(ScanColl, Patch(InventoryCountingJournalLines,
LookUp(InventoryCountingJournalLines, JournalNumber = Journals.SelectedText.Journal
&& ItemNumber=item_id && InventorySiteId=item_site
&& WarehouseId=item_warehouse && WarehouseLocationId=item_location),
{CountedQuantity:item_count})))
,
ForAll(ScanColl, Patch(InventoryCountingJournalLines,
Defaults(InventoryCountingJournalLines),
{JournalNumber: Journals.SelectedText.Journal,
ItemNumber: item_id,
ItemBatchNumber: item_batchnumber,
InventorySiteId: item_site,
WarehouseId: item_warehouse,
WarehouseLocationId: item_location,
CountedQuantity: item_count}))))
What should i fix?
Please help.
Thanks.
pytbyt
Hello,
I'm new to Power Apps and I have the same issue, I have a form with multiple screens and when submitting a screen will go to the next one even if the mandatory fields are not filled.
I tried the mentioned solutions without success.
I have Screen1 with Form1 and the default formula used was SubmitForm(Form1) & Navigate(Screen1_1)
When I tried the below solution it didn't work
If(
IsEmpty(
Errors(
'Quality Check',
Patch(
'Quality Check',
Defaults('Quality Check'),
{
Column1: "xxx",
Column2: "xxxx",
Column3: "xxx",
...
}
)
)
),
Navigate(Screen1_1,ScreenTransition.Cover)
)
Instead of column 1, 2 ,3 I entered the columns from my form and still dind't work, not sure about "xxx" is there supposed to be a value?
Thank you!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
186 | |
53 | |
50 | |
34 | |
33 |
User | Count |
---|---|
266 | |
91 | |
78 | |
68 | |
67 |