cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tanisantos
Helper I
Helper I

How to make patches works synchronously

Hello everyone my name is Taniguchi, and i having trouble because i need to insert a button to do two patches, one for create and other for update i need in the end on flow the new row is created and updated. but when i press the button is only creating because they try to create and update at the same time and the update dont work because the row dont exist yet. so i need a way to do a two patches and the second one wait ultil the first is ready to start.

how can i make a button to execute two patches and the second patch wait until the first patch is done do iniciate ?

2 REPLIES 2
MrNappa
Advocate V
Advocate V

I think execution of code in UI is sequential. Maybe you can try the following:

Add a button 1 that does the patch with Create (in OnSelect code). Add a button 2 that does the patch with Update (in OnSelect code). Set the button2.Visible to 'false'. In the button 1 code, after the Patch call, trigger the (invisible) button2 with "Select(button2)".

 

If my assumption is correct, first the OnSelect code of button1 will be run, and only after it completes it will run the OnSelect code of button2. But I didn't try it myself, so attempt it and see if it works. Good luck!

RezaDorrani
Dual Super User II
Dual Super User II

Hi @Tanisantos 

 

Patch(.....);Patch(......)  - will execute your patches in sequential format

 

However if you want to ensure that Patch was siuccessful before executing next Patch

 

then Set(response,Patch(.....))   - the variable response object will give you details if any error

check the response and accordingly execute the next Patch

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,297)