Update Existing Content Items

Goal

Update existing content items in a particular environment (e.g. production) as part of a new release.

Stakeholders

Developer, Administrator

Prerequisites

No content items in the target environment are being edited.

No content items in the target environment have outstanding publication requests.

Writing Updater Scripts for Existing Content Items

When deploying a new release it is sometimes necessary to update existing content items. Some example use cases are:

  • A new field with a non-empty default value is added to a document template. The default value must be added to existing documents.
  • A new variant is added to an image set template. The new variant must be added to existing image sets.

To update existing content items an Updater Script must be written and executed. The Updater Script can be developed and tested in the development environment using the Updater Editor in the CMS UI. Once completed, the script can be packaged with the release so it can be executed in the target environment after deployment of the new release.

The procedure is as follows:

  1. Inventorize which content types need to be updated and what changes need to be applied to content items of those types.
  2. Write an Updater Script to make the required changes using the Updater Editor in your development environment.
  3. Test the Updater Script on a relevant set of content in your development (or test) environment.
  4. Once you are satisfied, add the script to your project's repository-data-application module so it will be added to the updater registry (JCR path /hippo:configuration/hippo:update/hippo:registry) on deployment in the target environment.
  5. Prepare the release as usual and release the required artifact(s).
  6. Deploy the release artifact(s) in the target environment.
  7. An administrator runs the Updater Script in the target environment. The affected content items will be updated.

Summary

  • Existing content items in the target environment may need to be updated when a new release is deployed.
  • Updater Scripts can be used to update existing content items.
  • Updater Scripts are developed in the development environment.
  • Updater Script are packaged with the release artifact(s).
  • Updater Script are executed by an administrator in the target environment.
Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?