How to set an id for new LocalDB record?

I want to create a copy of record from DB in LocalDB with the same id.
Is it possible to somehow set an id for the new LocalDB record?

@khilda At the moment it is not possible to set ID via the DB API (this API is used both in the Runtime, ie in App, and in CloudCode)
You can set the ID of objects via the Backend though, both using CSV import and the Backend API.

So to answer your question, you cannot directly set the value of the object’s ID in LocalDB and so the recommended solution for doing what you want to do is to have a separate text field defined on the model that you use only in LocalDB where you can store the ID of the DB object in question

I hope this makes sense

PS. Please feel free to suggest this as a feature request on our Public Roadmap

1 Like