PreCommit event

According to the user guide I understand we can get the oldValue of an attribute before commitListener as follows:

event.getChanges().getOldValue("approved")

How can we get any attribute value (current) of the same attribute before commit from Entity Listener?

I tried this but it still shows old value: event.getChanges() getValue("approved")

You can load the entity instance and get the current values of its attributes. It is shown in the examples of the docs.

Hi Konstantin
Thanks for your comments. I tried it already, please see below my code and the status of the field value:

  1. Loaded the entity
    image

  2. When I changed the status of the field value (here it’s “approved”)= true from my screen and save the entity, it triggers the event Listener but the entity I load still shows the status of field “approved”, it still shows approved = false:

image

Is there anything wrong in my code?

I don’t see anything wrong.
The AttributeChanges object contains previous (old) state of the changed attributes.

Yes, that’s right but what I need is new state before commit.

The new state is in journal.getApproved().

Yes, that’s what I tried as you can see the images shared, but I get the value = false, while I actually have selected (true).

Perhaps some code changes the value after you set it to true.
Try to just set a breakpoint to the setter and see when it’s changed.