Contentful logo

Contentful Community

updatedAt not updated if I edit a reference field

In my app I want to expose when the last change was made per entry. (Imagine a blog post style content model)

Normally if I edit a title field and hit publish then updatedAt does indeed change correctly. But my reference field contains lots of sections and I edit one of those references then the parent updatedAt doesn’t budge.

What can I do? Thank for your time & help!

Hi @graz,
Your assumption is correct. Since the fields are technically referenced and not embedded, changing one of them does not change the parent entry.

Since, I imagine, your App has to retrieve the parent and referenced entries anyway, the best solution would probably be something like this:

  1. Retrieve the parent entry and save its updatedAt in a variable
  2. Retrieve the referenced entries, and loop trough them.
  3. When you find a more recent date, you updated the initial updatedAt variable
  4. Print the variable

I hope this help