I have a form that uses the patch function on submit. How do I show a 'Your request has been submitted!' message after the patch function has executed when a new form is submitted?
Solved! Go to Solution.
@ahhollan
Right! I didn't read carefully enough. Here's the code for PATCH.
Set(varRecord, Patch(your_code_here));
If(!IsBlank(varRecord),
Notify("Your request has been submitted!", Notification.Success),
Notify("Your request was not submitted", Notification.Failure)
);
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
If you are using a form control, the form has a onSubmit property that you can use to navigate to a new screen or to show a pop up or a modal with the success message.
However, If you are using a patch function instead of Submit(Form) formula then you can check if there were any errors from the patch(). If there weren't any errors you can navigate to a new screen or show a pop up or a modal with the success message.
Patch(DataSource, Record); If(IsEmpty(Errors(IceCream, EditRecord)), <Show Success Message>, <Show failure message>)
You can find a similar scenario as yours on the page.
Take a look at this article on how to display a dialog using Power Apps.
https://powerapps.microsoft.com/en-us/blog/creating-dialogs-in-powerapps/
Follow those steps and use an UpdateContext() after the Patch() in your onselect to display the dialog. Have a button or 'X' on the dialog to dismiss it and updateContext() to false to make the dialog disappear again.
@ahhollan
Put this code in the OnSuccess property of your Form
Notify("Your request has been submitted!", Notification.Success)
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
This formula doesn't work since I'm using the patch function and not SubmitForm. I'm seeing a lot about using updatecontext, but I haven't fully figured that out yet.
@ahhollan I used this video to do a similar functionality of one of my projects. https://www.youtube.com/watch?v=SaDEVOgOlYY&list=PLcwrIWK7WBcRyFBAFeC-Ws8kJYAGTc8Qi&index=16
@ahhollan
Right! I didn't read carefully enough. Here's the code for PATCH.
Set(varRecord, Patch(your_code_here));
If(!IsBlank(varRecord),
Notify("Your request has been submitted!", Notification.Success),
Notify("Your request was not submitted", Notification.Failure)
);
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
I had to change Notification to NotificationType, but once I did that it worked. Thanks for all the help. You are always helpful and quick to respond.
There's also a "Success Message" field on the Entity Form where you can simply add the desired message.