How come when I api.delete something that I can still api.find it?


I ran this in a test drive with allow object modifications turned on and it successfully deletes the item, but api.find still returns it.


SQL queries are usually not immediately flushed to the DB right when you execute the api call (within the same TX). It is a trade-off between throughput and some special cases.

So bottom line is that you should not expect the data modifications immediately appear within the same formula execution.

There is no intention to add formula based transaction control.

Possible workarounds:

Modify the code that the next api.find() ignores the deleted item.

One JSON backend call is one closed DB transaction. So if the two calls are sequential then the 2nd call will see the situation after the first call. If the calls come in parallel, the find will still see the old value that the other call deletes.

Found an issue in documentation? Write to us.