BeforeUpsert problem

Hello,
I have a question about the EventHandler BeforeUpsert. I would like to document changes in data records and would like to check in this EventHandler which values were in the data record before and which after. I therefore wanted to use the EventHandler BeforeUpsert and then query the database (Load Table objects) which values were in the database before the update. When I query the current object, the change is already there in the database. It looks like the EventHandler BeforeUpsert is then the EventHandler AfterUpsert.
Am I doing something wrong?

1D587F4E-EAEB-B148-FF91-47B0E1F88F00

Hello @Gerrit_Marttila

I just tested this example and it works fine for me. The previous value is saved in a separate table.
Maybe you have other handlers?

Try to test this logic with new simple tables.

I have something like this:
Two table. One “MainTable” with column “name” and other “MainTableHistory”

Trigger

Handler:

Regards

I don’t understand. I have the values for the handler BeforeUpsert and AfterUpsert in an auxiliary table and the values are always the same (see screenshot). However, as in the first screenshot, I call the data from the database in BeforeUpset and save it in the auxiliary table ArtikelInLagerplatzCheck. However, the values after the update are always available. That’s really weird.

Hello @Gerrit_Marttila ,

You can try changing the context block in After Upsert from “Request Item” to “Response Result” as shown in the screenshot.

Regards,
Sergey