Fetching Related Data Objects in currentUser

I’m sorry if I missed it somewhere, but I couldn’t seem to find an answer in the documentation specifically about this.

When registering my user, I add a couple of related Data Models that exist out in our Data, to the user object. It gets saved fine, and when I go to the Portal to the User model, I’m able to clearly see that they were properly attributed to the user (and when I click on them, they properly go to the right entry in those Models). However, on the app side (iOS), the “currentUser” always shows Null for those related models. I can confirm this via the getProperties call as well:

NSLog(@“properties: %@”, [backendless.userService.currentUser getProperties]);

This prints, for example, one of our Models which is called “organization”:
organization = “<null>”;

What is the proper way of doing this? Do I need to do an additional fetch with the currentUser’s objectID in order to fetch those related model objects and get them into the “currentUser” user? Or is there a better way?

Thanks in advance, and let me know if I need to provide more info.

Hi Vincent,

Backendless does not return relations by default. You can use the “Two-step relations retrieval” approach described here:
https://backendless.com/documentation/data/ios/data_relations_retrieve.htm

Regards,
Mark

Thank you! I overlooked that one.