SetObjectRelations

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 (3.x / 6.x, Online / Managed / Pro )

I would like to insert a record in a table called: UserContacts

There is a relationship between UserContacts and Users tables. I cannot store the reference data.

Client SDK (REST / Android / Objective-C / Swift / JS )

Application ID

SANJSOFT

Expected Behavior

I should be able to add a record with relationship id bound to User table (email).
I am getting the following error:
400 - Relation Parent must be provided and must be a string or an object with objectId property.
1.
2.
3.

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.

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.

Use a block that is called Deep Save and pass in the entire object structure you need to save.

Mark

Thank you!

Deepsave works to add email id in Users table. I have one another issue:
I just want to relate userEmail column in UserContacts table to email in Users table.

this is giving me: 400 - Unable to create relation. Child object with id ‘a@b.com’ is not found in the related table. (1303)

I am passing the following parameters:
{
“firstName”: “john”,
“lastName”: “doe”,
“phone”: “3453345345”,
“email”: “jo@doe.com”,
“userEmail”: “a@b.com
}
a@b.com exist as a record in Users table under email col.

Hi, @Sanjay_Christian

The problem seems to be with the provided parameters. The following error

400 - Unable to create relation. The child object with id ‘a@b.com’ is not found in the linked table. (1303)

means that the server expects the objectId as a provided parameter to establish a relationship between two objects. While you pass the userEmail parameter.

Regards, Marina