Support Topics Documentation Slack YouTube Blog

I'm unable to get the objectId of my last saved object on backendless

I’m unable to get the objectId of my new saved Group, the group is saved in the database but then I can’t get its objectId, and I need it as a String for the relations method.
Here my code.

Plus the selected breakpoint is here the app crashes.

Please, give your App Id, and write error.

Hopefully this will make it clearer for you:

When you use ASYNC api, it is processed in a separate thread. You cannot assume that the next line of code you place after the async call will give you the data which you save in the previous line.

Mark

How can I fix it Mark?? add some stuff before?

Denys, this? 0A8D8AA1-7A68-D106-FF1D-1AE0D785C600

Think about the flow of the app: you make an async call to save group. That call gives you a callback when the group is saved (the “handleResponse” method). That callback gives you the saved group right there, it already has assigned “objectId”. Just use the callback and put all the logic in there.