cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Transactions with Powerapps

Hi,

 

I have a powerapps up and running, and it does everything I want. This is connected to an on premise SQL database. One button in this app deletes data from multiple tables that are key linked. In the example below, Table1 has a primary key that is used as a foreign key in Table2, which is what I am filtering on.

 

 

 

Remove('[dbo].[Table2]',Filter('[dbo].[Table2]',ID=SelectedID));
Remove('[dbo].[Table1]',Filter('[dbo].[Table1]',ID=SelectedID));

 

 

 

The issue I have is that if the user refreshes the page after clicking the button, there is a chance that the first row has finished, but not the second, This leaves the DB with a record in Table 1 that is not linked to a record in Table 2, and we have to go manually into the database in order to delete this record. 

I know in SQL Server this can be solved using transactions. Is there a way to solve this using powerapps?

3 REPLIES 3
Pstork1
Dual Super User III
Dual Super User III

There is nothing built-in to Power Apps that provides transaction support.  I would handle this by using a stored procedure called from a Power Automate flow.  That will prevent the user from interferring with the deletion until it is complete. You can also use the stored procedure to implement the deletion as a transaction.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Anonymous
Not applicable

Thanks for your help. I definitely considered this, but I was hoping there was an easier way to solve this using powerapps. If not this is what I'll end up doing.

KPawel
Regular Visitor

Hello,
 
We have a similar problem with transaction support in Power Apps. In our use case we would like to achieve clear object read then check some conditions and eventually write object to Dataverse for Teams table. We have seen that Power Automate has a transaction block but it doesn't allow adding conditions inside it.
Is it possible to somehow make it work so that we achieve transaction support?
(scenario: many users try to read and write data at the same time).
 
Thanks for the reply.

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

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

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 (1,914)