Get user data before update business logic

How can I get User data before update, I want to compare data in business logic
I call methods beforeUpdate and afterUpdate, both return new value

userResult.png

Hi Ihor

I’m not sure that I understood you correctly. Could you please provide some additional info:

  1. What is the final goal? You are updating property A in the Users table, and you want to get the old value of A property (before it was updated) and then to get the updated value of the same property?
  2. How do you call beforeUpdate and afterUpdate methods?

Regards Anton

I want to get value before it was updated and after it was update and compare them.
I don’t call this methods, they call automatically, this is server side logic

Got it. I’ll try to reproduce the behavior you’ve described and respond back ASAP

Regards Anton

Ok, thanks, i’m waiting for response, because it is very important for me

Are you using backendless 3 or 4?

I am using backendless 3

Ok, I figured out how to implement what you need. If you will try to extract the old value from userValues in beforeUpdate you will be receiving the updated value.

If you need to get the old value - call

Backendless.Data.of(Backendless.User.class).findById("xxxx-yyyy-zzzz-cccc-qqqq").getProperty("name");

or extract the value of required property from current user if it’s logged in.

No changes required in afterUpdate code.

Regards Anton

Thanks