Can I use this?

The new meta fields outlined in this article are available since v5.39.0.

Introduction
anchor

Apart from the fields that are defined in a content model by the user, all content entries also have a set of date/time and identity-related meta fields. A couple of examples:

  • revisionCreatedOn - the date/time when an entry revision was created
  • revisionFirstPublishedOn - the date/time when an entry revision was first published
  • createdOn - the date/time when an entry was created
  • lastPublishedOn - the date/time when an entry was last published

These meta fields are automatically populated by the system, and they can be used to display information about the entry, such as when it was created, modified, or published, and by whom.

Developers can use these fields when querying entries, for example via the Headless CMS GraphQL API:

They can also use them in their custom JavaScript (TypeScript) code, for example, when hooking onto lifecycle events:

Revision-Level and Entry-Level Meta Fields
anchor

The meta fields are available at two levels: revision-level and entry-level.

Revision-level fields include the revision prefix in their names, and they contain information about the revision of an entry. For example, revisionCreatedOn is the date/time when the revision was created, and revisionCreatedBy is the identity of the user who created the revision.

On the other hand, entry-level fields do not contain the revision prefix in their names, and they contain information about the entry itself. For example, createdOn is the date/time when the entry was created, and createdBy is the identity of the user who created the entry. These fields do not change when a revision is created, modified, or published, nor if new revisions are created, modified, or published.

Meta Fields
anchor

The following table lists all the date/time and identity-related meta fields that are available for content entries.

Revision-Level Meta Fields
anchor

FieldDescriptionCan be null
revisionCreatedOnThe date/time when an entry revision was created.No
revisionModifiedOnThe date/time when an entry revision was last modified.Yes
revisionSavedOnThe date/time when an entry revision was last saved.No
revisionFirstPublishedOnThe date/time when an entry revision was first published.Yes
revisionLastPublishedOnThe date/time when an entry revision was last published.Yes
revisionDeletedOnThe date/time when an entry revision was last deleted / moved to the trash bin.Yes
revisionRestoredOnThe date/time when an entry revision was last restored from the trash bin.Yes
revisionCreatedByThe user who created an entry revision.No
revisionModifiedByThe user who last modified an entry revision.Yes
revisionSavedByThe user who last saved an entry revision.No
revisionFirstPublishedByThe user who first published an entry revision.Yes
revisionLastPublishedByThe user who last published an entry revision.Yes
revisionDeletedByThe user who last deleted / moved to the trash bin an entry revision.Yes
revisionRestoredByThe user who last restored an entry revision from the trash bin.Yes

Entry-Level Meta Fields
anchor

FieldDescriptionCan be null
createdOnThe date/time when an entry was created.No
modifiedOnThe date/time when an entry was last modified.Yes
savedOnThe date/time when an entry was last saved.No
firstPublishedOnThe date/time when an entry was first published.Yes
lastPublishedOnThe date/time when an entry was last published.Yes
deletedOnThe date/time when an entry was last deleted / moved to the trash bin.Yes
restoredOnThe date/time when an entry was last restored from the trash bin.Yes
createdByThe user who created an entry.No
modifiedByThe user who last modified an entry.Yes
savedByThe user who last saved an entry.No
firstPublishedByThe user who first published an entry.Yes
lastPublishedByThe user who last published an entry.Yes
deletedByThe user who last deleted / moved to the trash bin an entry.Yes
restoredByThe user who last restored an entry from the trash bin.Yes

FAQ
anchor

What Is the Difference BetweenmodifiedandsavedMeta Fields?
anchor

The difference between modified and saved meta fields is that modified fields can be null if the entry has not been modified yet, while saved is never null because it is updated even when the entry is created.

So, if we were to create a new entry, the createdOn and savedOn fields would have the same value, but the modifiedOn field would be null because the entry has not been modified yet. Only after the first update, the modifiedOn field would have a value different from null. Actually, after the first update, the savedOn and modifiedOn will always have the same value.