losing relationship on user update

Hi Oleg

Yes, it’s default behavior. When you update user object the server returns only plain properties without relations

I can propose you a few workarounds:

  • keep relations in another variable
  • reload relations in the next api call
  • use Business Logic, create an Event Handler “afterUpdate” and in the handler extend updated object with relations what you need

Regards, Vlad

Thank you for your reply!

Just for comparing:

v.3

BackendlessUser updatedUser = Backendless.UserService.update(user);

v.4

Object[] devicesObjectArray = (Object[]) user.getProperty(Consts.DEVICES);
Object[] usersObjectArray = (Object[]) user.getProperty(Consts.CONTACTS);


BackendlessUser updatedUser = Backendless.UserService.update(user);


updatedUser.setProperty(Consts.DEVICES, devicesObjectArray);
updatedUser.setProperty(Consts.CONTACTS, usersObjectArray);