0

I have this formula inside the Submit Button:-

Patch('Printing Orders Details', ForAll(PrintOrderDetailsGallery.AllItems, { ID: ID, Quantity: Value(PrintOrderQuantity.Text), 'Quantity Each Artwork':PrintOrderQuantityForEachartwork.Text, 'Network ID':PrintOrderNetworkComboBox.Selected.ID } ) ); SubmitForm(PrintOrderForm) 

Which Patch some items and submit a form. but currently if the Patch raised an error, i will get an error message for each Patch (so if i have 5 items inside the ForAll, i will get 5 error messages)>> but at the same time the submit form will be executed,,, which will result in an inconsistent state of our data.. so how i can ensure that the Submit Form will only be executed if all the Patches inside the ForAll went successfully, if not to still show errors for each Patch ?

1 Answer 1

1

You can use Errors() in Power Apps to to perform Error Handling for Patch function in Power Apps.

Example:

// create a new record in test scores list Patch( 'Test Scores', Defaults('Test Scores'), { TestName: txt_TestName.Text, StudentName: txt_StudentName.Text, Score: Value(txt_Score.Text) } ); If( // check if there were any errors when the test score was submitted !IsEmpty(Errors('Test Scores')), // if true, show any error message Notify( Concat(Errors('Test Scores'), Column&": "&Message), NotificationType.Error ), // else, go to success screen Navigate('Success Screen'); ) 

In your case, you can use SubmitForm() function inside // else, go to success screen block in above formula.

You can find more information related to this and other error handling ways at: Power Apps Patch Function Error Handling

2

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.