setAttributes

Set the values of the fields of this CMS item. May return null if the item was deleted before this method was called.

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

Parameters

Returns

  • Promise<CollectionItem | null> – The updated CollectionItem, or null if the item no longer exists.