Relation to: users

Are you looking for help?

This is a support forum for reporting issues related to Backendless services. Please note that due to our support policy we cannot provide you help with debugging your code, consulting in regards to any language or third-party library usage. For this kind of questions we recommend using more appropriate forums like Stack Overflow.

In order to suggest you a quality solution, we shall usually ask you to provide the details mentioned below first. Including them into your topic right away helps us to start investigating your issue much faster.

In case you have a suggestion or an idea, the details below are not always required, though still any additional background is welcome.

Backendless Version 5.3.0, Online

Client SDK Android

Application ID 47C214FB-5083-E90F-FFC3-F1536A825C00

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. App sets “friends” status between users of the same Date Base.
    BackendlessUser[] newFriends;
    Object[] currentFriendsObject = (Object[]) user.getProperty(“friends”);
    newFriends = new BackendlessUser[currentFriendsObject.length + 1];
    newFriends = new BackendlessUser[]{friend};
    user.setProperty(“friends”, newFriends);

  2. In next step I have the update of the user relation “friends” column and get the Log message below. So the AsyncCallBack response was good, as I understand:
    Backendless.UserService.update(user, new AsyncCallback() {

  •                            @Override
                              public void handleResponse(BackendlessUser user) {
                                  Log.i("Reporting ","Update user 1 with new friend ");*
  1. In Data Browser the relation should now be visible with the new “friend” RELATIONS

Actual Behavior

Please provide a description of what actually happens, working from the same starting point.

Be descriptive: “it doesn’t work” does not describe what the behavior actually is – instead, say “the request returns a 400 error with message XXX”. Copy and paste your logs, and include any URLs.

1.My Data Browser never gets updated with the new relation.
2.However, if I set relation directly in the Data Browser it works fine.

Reproducible Test Case

Please provide a simple code that could be run in a new clean app and reproduce the issue.

If the issue is more complex or requires configuration, please provide a link to a project on Github that reproduces the issue.

Hello, I can recommend reading this documentation.

it says how to work with relations

Regards, Denys

Hi @Guilherme_Vicente,

The way Backendless API works is both parent (user) a child (friends) objects need to be stored in the database before you establish a relation between them. To establish a relation, there is a separate API call documented here.

Hope this helps.