cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sch
Level: Power Up

Patch() with Errors() - error handling

I am adding a new record to my SharePoint List:

 

Patch(MyCustomList, Defaults(MyCustomList), { Title: "CustomTitle" });

 

How can I be sure that this record has been / will be successfully added to my list?

 

My thought so far:

  • Use before (or after?) Patch(): !IsEmpty( Errors( MyCustomList, Defaults(MyCustomList) ) )
  • After Patch(): get last record from the list and check if this is record I intended to add
2 REPLIES 2
Super User
Super User

Re: Patch() with Errors() - error handling

You use the Patch() in a variable and then test the variable to see if a record is created and it if has an ID.

 

Example of setting a variable using the results from Patch() :

Set(gvNewItem, Patch(PowerAppsDemo, Defaults(PowerAppsDemo),{Title:"Test"}))


--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Community Support Team
Community Support Team

Re: Patch() with Errors() - error handling

Hi @sch,

 

What @Jeff_Thorpe suggested works, and you could add a Label, set its Text property to:

gvNewItem.ID

You could check if the ID number in this Label control is changed after you run the Patch to make sure that the new record is added.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 327 members 5,628 guests
Please welcome our newest community members: