Support Topics Documentation Slack YouTube Blog

Get objectId in product table

Hi.
I used this code:

        Backendless.Data.of(Test::class.java).find(object : AsyncCallback<List<Test>> {
            override fun handleResponse(foundContacts: List<Test>) {
                listData.value = foundContacts
            }

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

and my Test::class.java is:

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


fun save(): Test {
    return Backendless.Data.of(Test::class.java).save(this)
}

fun saveAsync(callback: AsyncCallback<Test>) {
    Backendless.Data.of(Test::class.java).save(this, callback)
}

fun remove(): Long? {
    return Backendless.Data.of(Test::class.java).remove(this)
}

fun removeAsync(callback: AsyncCallback<Long>) {
    Backendless.Data.of(Test::class.java).remove(this, callback)
}

companion object {

    fun findById(id: String): Test {
        return Backendless.Data.of(Test::class.java).findById(id)
    }

    fun findByIdAsync(id: String, callback: AsyncCallback<Test>) {
        Backendless.Data.of(Test::class.java).findById(id, callback)
    }

    fun findFirst(): Test {
        return Backendless.Data.of(Test::class.java).findFirst()
    }

    fun findFirstAsync(callback: AsyncCallback<Test>) {
        Backendless.Data.of(Test::class.java).findFirst(callback)
    }

    fun findLast(): Test {
        return Backendless.Data.of(Test::class.java).findLast()
    }

    fun findLastAsync(callback: AsyncCallback<Test>) {
        Backendless.Data.of(Test::class.java).findLast(callback)
    }

    fun find(queryBuilder: DataQueryBuilder): List<Test> {
        return Backendless.Data.of(Test::class.java).find(queryBuilder)
    }
    fun findAsync(queryBuilder: DataQueryBuilder, callback: AsyncCallback<List<Test>>) {
        Backendless.Data.of(Test::class.java).find(queryBuilder, callback)
    }
}

}

I get all the values ​​correctly but the objectId is null. I want to use objectId in another activity to get product details. what’s wrong? How can I fix it?

This appears to be a duplicate of https://support.backendless.com/t/objectid-is-null Please post only one topic for each question you have. Closing this one.

Mark