setAttributes

setAttributes

Set the values of the fields of the CMS item.

const updatedCollectionItem = await collectionItem.setAttributes({
    slug: "new-slug",
    fieldData: {
        [ageField.id]: { type: "number", 48 },
    },
})

Params

  • update: EditableCollectionItemAttributes – The updated attributes for the collection item.

Returns

  • Promise<CollectionItem | null>

Caveats

  • May return null if the item was deleted before this method was called.