Changing checkbox values - API shows both old and new

Describe the issue:

We have a JSON field type with the presentation of Checkbox group. The labels and values for the check boxes are being changed. When making a request in the CDA playground, I see the new value but also the old which has been deleted.
Screenshot of the new “test” checkbox and can see all other options have been removed :

When making a query for “tags” we get both the old data (“low”) and the new data(“test”) in the response :
Screenshot 2024-09-03 at 15.34.59

Ive refreshed the CDA playground to make sure it schema was updated however unsure how to resolve the issue of old data coming through.

Sorry @sysadmin_sfa,

The presentation setting is just a cosmetic UI change, and it won’t retroactively go through existing records to update their field data :frowning:

If you need to do that, I’m afraid it would have to be a manual bulk update using the CMA:

First list all records of that model: List all records — Record — Content Management API

Then update their JSON field: Update a record — Record — Content Management API with something like:

const tagsFromAPI = ['low', 'lower', 'test', 'high']

const tagsToRemove = ['low', 'lower', 'lowest']

const newTags = tagsFromAPI.filter(oldTag => !tagsToRemove.includes(oldTag))

console.log(newTags) // returns [ 'test', 'high' ]

I know that’s a bit of work :frowning: It would be a good idea to try it in a sandbox environment first. Sorry about the hassle!

1 Like