Currently we’ve a lot of similar models to handle pages (e.g. homepage, privacy page, basic page). I want to migrate them all to a new collection called ‘page’. Is there an easy way to migrate modular content and structured text fields?
I getting the following message
'Cannot define id
in block record objects when creating an Item'.
I tried to use the nested property in
client.items.list, but without success.
What are my options? Do i have to extract all attributes and create new ones for each nested section? Seems a lot of work, because the structure / validation of the modular field is exactly the same.
Hello @mark and welcome to the community!
and that you are receiving the error
The issue is that, when you request the record with nested set to true, it returns the record, its ID, and all of the blocks inside of it, and their IDs.
However, if you want to add that block to a new record you need to remove the “ID” parameter from that block, as you can’t specify custom IDs when creating a block.
You can use a recursive function to do so like this one: record-bin-lambda-function/recursivelyDeleteAllBlockIDs.ts at master · marcelofinamorvieira/record-bin-lambda-function · GitHub
Thanks a lot! I successfully moved the fields to the new model. I somehow thought that i needed to fetch and transform each block separately to create a new one. Deleting the ids recursively did the job.