Relations issue (Codeless)

Backendless Version (Online )

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

Application ID

9B730A39-F28C-16DF-FFD5-C6C0E5977300

Expected Behavior

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

  1. Create an object in the SimpleWorkItem table
  2. Create a relation between the SimpleWorkItem object and its parent in the ProjectIndex table

Actual Behavior

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

  1. Create an object in the SimpleWorkItem table
  2. That’s it.

Not sure how to get ahold of any logs, very much a beginner at this!

Reproducible Test Case

Hello @William_Wright

Sorry for the long wait. We are investigating your problem and will try to offer you a solution as soon as possible.

Regards,
Inna

Hi,

Has there been any developments on this? I still haven’t figured this one out.

Thanks!

Hello @William_Wright

I suspect that you use string in “parent object” property

Try somethig like that


If you have 1:n relations, you can add more objects in “create list with” block

Regards,
Viktor

Hi Viktor,

This sounds great, but I am not sure how to get the object ID for the relevant objects? I was hoping to use the qNum property as that was supposed to be unique, and it was one of the fields in the first (parent) form so I knew I could pass it to the second (child) form.

I hope that this makes sense.

Hello @William_Wright

Hope I understand you correctly

In “Save object” block mark check box to return a object contains property of objectID

Also to get record’s objectId use “Load Table objects” block with “where clause” property.
Search with the Where Clause
With “Load Table objects” block you can find you record by “formQNum” and get this objectId

Regards,
Viktor

Thanks Viktor, I’ll give that a try!

Hi,

Unfortunately the returned value I am getting is [object Object], and it still doesn’t establish a relation.


image

could you please create a simple page with minimal logic to reproduce the issue?

Hi,

I am still working on this, and had no luck yet! To make it simpler, I have moved both forms to one page and I am just hiding the work item form until it is needed.

I am still getting [object Object] as the parentProject, which from what I am understanding from what I have been told earlier should be the objectID of the parent (ProjectIndex) object?

This is the latest version of my logic:
Parent object creation:

Child object creation & add relation:

App ID is still the same. 9B730A39-F28C-16DF-FFD5-C6C0E5977300

Hello @William_Wright

As I see in block Add Object Relation you use SimpleWorkItem column which in not exist in ProjectIndex tabel.

Regards,
Viktor

Hi Viktor,

Thanks! I’ve fixed this now, but it still doesn’t work. I now don’t even get the [object Object] in the Parent Project field of the Work Item form.

Hi William,

Please understand that our support can focus on issues related to specific APIs, specific codeless blocks, functions in console. Digging into customers logic and figuring out problems in your app is not part of the support charter. Please use facilities available to you to debug the problem such as capturing debug and logging information to understand where the problem is, but I wanted to set the expectation that this is not what the support team does.

Regards,
Mark

Hi Mark,

Thank you, I appreciate the clarification. Specifically at the moment I just need to know why the Save Object in Backendless block does not seem to be returning a value, specifically the new object’s objectID? I either get nothing, or I get the value [object Object].

Try using the “print” block to see what the block returns. You would be able to see the result in the real-time logging window.

Thanks Mark, I’ll try that. Where can I access this logging window? I’ve tried the log file in the Logging folder but it is blank.

nm, I think I found it! It is under Manage on the backend, then Log Management, then real-time logging.

1 Like

Okay, so I have put a Print in there, and nothing came up when I clicked on the button. It created an object, but no log appeared. So I have put a Print with a set output (hello) at the top of the click event, and that doesn’t appear either.

That means the code glow doesn’t get to that point. Try using the try/catch block to see if there are any errors

If your logic is in UI Builder, print is going to Dev Tools(usually is F12 key).

Also, the problem with [Object object] occurs when you mutate an object to a string. I think it’s happened with your parentProj.

What I see in your app:

When you set parentProj to Form Data, and bind it to input. You see [Object object] because DOM inputs can work only with strings, and he forced mutation.

Here you transform a string into an object. That can work only if a string is valid JSON. But you try to transform [Object object] or an empty string, what not be a valid JSON.

Regards, Dima