Support Topics Documentation Slack YouTube Blog

objectId is null

Hello
when I get table field values objectId value is null but other values are correct.
it should be noted, The ID column in the table contains the value

Hello,

Are you talking about specifically the objectId column or some other column containing some other id? What made me wonder is the subject of your topic references objectId, but in the description you mention ID

Mark

i mean the default objectId column. I need this value to know the product.
i dont have id column

Do you retrieve data using the map/dictionary approach or using the custom class approach? If the latter, the class representing data in your table must declare a public objectId field/property.

Regards,
Mark

i use custom class.
should i change it on the table?

Does your custom class contain public objectId property(field)?

my custom class is here:

class Test {
var prName: String? = null
var objectId: String? = null
val updated: java.util.Date? = null
var prImage: String? = null
val ownerId: String? = null
val created: java.util.Date? = null

}

Seems to be ok. Could you provide example of method invocation? So that I can try to reproduce your issue.

here is my request to backendless:

   Backendless.Data.of(Test::class.java).find(object : AsyncCallback<List<Test>> {
            override fun handleResponse(foundContacts: List<Test>) {
                Timber.e("remote object Id is: ${foundContacts[0].objectId}")
                listData.value = foundContacts
            }

            override fun handleFault(fault: BackendlessFault) {
                // an error has occurred, the error code can be retrieved with fault.getCode()
            }
        })



            Timber.e("remote object Id is: ${foundContacts[0].objectId}")

in this line I get null.

Thanks, let me check

thank you

@saeed_noshadi I tried your code without putting objectId to new list, just printing ids and from my side everything works as expected. Maybe try to debug your code to understand what you missed.

yes other values is ok .only objectId is null

As I said from my side everything is ok with objectId.
Lets replace this line :
Timber.e("remote object Id is: ${foundContacts[0].objectId}") listData.value = foundContacts

with just simply printing
for ( test in foundContacts) println(test.objectId)
To make sure that you really do not receive objectId. Let me know if try it