I'm using a built-in DeleteAll action on an entity and whenever I step over it in the debugger of a server action, nothing is deleted. It does work if I'm running the app in a browser, but I can't delete records during debugging.
I've tried a few workarounds. Creating a dedicated server action with only the DeleteAll action that's called by a client action works, but calling that same dedicated server action from my server action doesn't. Creating a server action that manually deletes all the records by looping through them one-by-one also doesn't work.
But, load the web page and the old records are deleted.
Is this a known bug? Note that the exact same algorithm is being used with a different entity and the DeleteAll works fine in the debugger.
Could you share a screenshot of the DeleteAll action you are referring to? On the server side, there isn’t a DeleteAll action associated with an entity. A screenshot would help us better understand the issue.
Am I missing something? Here's the action in my method:
Here's the details on the right when it's selected (commented as "Run Server Action" below the name):
And here's the action listed in the Data tab:
This is not OS 11 application but an ODC application. The image below you can see the difference. Please verify and update the tags (Traditional Web) assigned to your question.
Not sure about the exact issue. Check if any Delete Rules might be causing this problem. You can also reach out to OutSystems support or wait for someone who has faced a similar issue and found a solution.
I apologize, new to the OS forums. There was a checkbox for OS 11 vs ODC and I thought I checked ODC. I'll see if I can edit the question to have the tags be more accurate.
Hi,
One possible reason I can think of is the database transaction. Each server thread only commit the transaction at the end of the server action. Also, if you aborted the thread before the end of the server action during debugging, it may result in the database rolling back the changes.
It's not a matter of waiting for the thread to complete nor one of aborting the thread before the end of the server action. I'm waiting for the action to complete (moves to the next action in the method) before doing anything, and the records aren't being deleted even after waiting some time.
A colleague on the team has reported a similar issue running on a different OS (I'm macOS, he's Windows). For now, since it works out of the debugger, it's less of an issue than I thought, but I'd still like to get it fixed.
Hi Charles,
Curious if there's any error logged? and wanted to confirm that this only happens during a debugger session?
You are performing the DeleteAll after looping through a list of ResponseData. Are there Entities that uses {WeeklyIpLoan}.[Id] as a foreign key?
Just wanted to get all these info to help us understand the issue. Thanks!
Regards,Mark
No error is logged. It is only failing during a debugging session.
The first time I noticed this it was set to happen before any looping. I tried setting it after the looping, at the last possible point at which it needs to happen (just before replacement records are created).
There are no relationships for which the Id could be a foreign key.
Hey Charles,
Apologies for the delayed response. To summarize the issue:
#1 While in debug: step over a built-in DeleteAll action on an entity, nothing is deleted
#2 workarounds don’t work.
.. but load the web page and the old records are deleted.
I noticed you mentioned "loading of the web page and the old records are deleted". I wanted to check how are you checking the content of WeeklyIPLoan entity while in debug? And are you calling a RefreshData action after the DeleteAll method?
Wanted to share that once the Thread pass thru the DeleteAll method, we will not see the changes in our front-end. We must use the Refresh action to refresh the aggregate call and allow the page to render so the deleted records are reflected. Another way is to right click on the Entity and click 'View or Edit Data' after the thread has pass thru the built in DeleteAll method.
Cheers and happy holidays!Mark