Hygraph
Docs
View as Markdown

#Copy a content entry to another project

Copy a saved content entry into a different project you belong to, without leaving the entry you're working on. Hygraph saves a draft in the target project. It does not publish the copied entry automatically.

If you want to make a copy of a content entry in the same project, you can duplicate the entry.

#Permissions

  • You must belong to the target project to copy an entry into it.
  • You need to have permission to create entries in the target model.

#Steps

You cannot copy an entry to another project from a new, unsaved entry form, from assets, or from variants.

  1. Open a saved content entry.

  2. Click ⋯ (More actions) in the entry title bar, then click Copy to project.

  3. In the Copy entry to another project dialog, choose the following:

    • Project: Only projects you belong to appear in Project.
    • Environment: If a project has more than one environment, you can select the environment you want to copy into.
    • Model: Only models you can create entries in appear in Model. The Model list isn't filtered by schema compatibility. You can select any model you can create entries in, even one with no matching fields.
  4. Click Continue. Depending on the schema in the source and target projects, one of the following happens:

    The entry is copied and saved

    Hygraph saves the entry in the target project as a draft. Click Open entry to view the entry in a new tab. If the target project has a content freeze, the entry is saved as read-only until the freeze is lifted.

    Copy and save an entry to another project
    The entry is saved, but some content was skipped

    Some values are skipped per the copy rules, such as locales the target doesn't have or references that can't cross projects. Hygraph still saves the entry in the target project as a draft with everything else copied.

    Copy and save an entry to another project, with some values skipped
    The entry is copied but not saved

    The entry is successfully copied into the other project, but the target project rejects it when Hygraph tries to save it. This may be because of a required field the source model doesn't have, a required relation that got skipped, or a unique title or slug that already exists. Click Continue in target project name to fix the problem there and save the entry. However, if there is a content freeze in the target project, the entry can only be saved after the freeze is lifted.

    Copy an entry to another project, but the save fails
    The entry is not copied

    Hygraph opens a Can't copy this entry dialog with a Schema doesn't match alert: "This entry can't be copied to {model}. Some fields don't match the target schema." Below it, a Fields list names every conflicting field and why, such as a field whose copied value is localized when the target field isn't. Click Back to choose a different project or model, or you can modify the target model's schema first.

    The entry cannot be copied due to schema mismatch

#Copy rules

Hygraph matches fields by the API ID. You can copy an entry from an Article model into a Page model, as long as the fields match by API ID. Extra fields that only exist on the target model stay empty.

Use this as a reference for exactly which options block a copy, which ones get skipped silently, and which ones don't matter at all.

Does not copy the entry

Hygraph opens the Can't copy this entry dialog if there is a mismatch in any of the following options between the source and target field. Extra fields that exist only on the target do not block the copy and stay empty.

OptionMust match
Field API IDThe source field must exist on the target, under the same API ID.
Field typeString, number, boolean, date, rich text, enumeration, taxonomy, component, relation, and union.
List vs. singleThe Allow multiple values setting.
Localized fieldThe Localize field option must match for fields and for localized components.
Target field visibilityThe target field must be editable. Read-only or hidden fields block the copy.
Enum values in useThe selected values must exist on the target enumeration, by value API ID. Unused extra values on the source do not block the copy.
Taxonomy nodes in useThe selected nodes must exist on the target. Unused extra nodes on the source do not block the copy.
Component typeThat component's API ID must be allowed on the target field.
Relation's related modelThe target field must accept that model's API ID. If it does, the related entries are still skipped, because they live in another project.
Rich text embedsIf the source entry actually embeds models in rich text, the target must allow embeds and those models.
Component list lengthMust fit within the target project's component list limit.
Does not affect copying

These can differ between source and target without blocking the copy. Hygraph creates a draft when the rest of the entry matches. Some of these are enforced only while saving the entry. You might need to finish creating the entry in the target project manually.

Enforced only on save:

  • Make field required. An empty required field on the target can prevent save, including a required field that exists only on the target, or a required relation that was skipped.
  • Set field as unique. Save can fail if that value already exists in the target.
  • Field validations such as regex or length.

Ignored for matching and for save:

  • Use as title field. The value is copied as-is.
  • Initial value for required fields (for models that do not have any content entries yet).
  • Migration value for required fields (for models that already have content entries).
  • Conditional visibility.
  • Enable variants. Variant entries cannot be copied to another project.
  • Model API ID. You can copy from Article into Page if the fields match.
  • Display name.
  • Description.
  • Renderer and app field configuration. The target field's renderer is used.
  • Remote fields and remote sources. These are not copied.
Skips field values and saves a draft

These are left out when they cannot be represented in the target project. Matching still succeeds, and Hygraph saves the entry as a draft with everything else copied. Studio lists what was skipped.

  • References and relations. These are always skipped, because the related entries live in another project.
  • Rich text that includes embedded entries. The written text is copied, but the embeds are left out, because those entries live in the other project. If the target field does not allow those embeds at all, Hygraph blocks the copy instead.
  • Locales the target doesn't have, or that you can't edit there.
  • An empty relation is not shown as skipped, since there's nothing to skip.

#Localized fields

Before copying, Hygraph checks the following localization settings on a field:

  • The Localize field option must match. If a field is localized in the source model and not localized in the target model, or the reverse, that's a schema mismatch. Hygraph blocks the copy. The same rule applies to a component's own localized setting.
  • The set of languages doesn't have to match. Once a field's Localize field option matches, Hygraph matches individual locales by API ID, such as en or de. The languages available on each project need not be the same.
ConditionOutcome
Same locale on both projects, and you can edit it in the targetCopied
Source has a locale the target doesn't, such as frThat locale is skipped. Other matching locales still copy, and Hygraph creates the draft.
Target has a locale the source doesn't, such as esThat locale stays empty on the new draft.
The locale exists on the target, but you can't edit it thereSkipped as a permission restriction, not a schema error.
The target's default localeAlways enabled on the draft, even if the source entry never used it.

#Required fields

Hygraph ignores the Make field required setting while checking whether the entry matches the target model. A field that's optional in one project and required in the other doesn't block the copy, as long as the field itself is the same field type.

If the target model has a required field the source model doesn't have, that field stays empty, and auto-saving the draft in the target project does not work. In this case, you need to manually update the required field value in the copied content entry in the target project, and then save the content entry.

#Title field

Hygraph ignores the Use as title field setting while matching. It isn't compared, and the values are copied like any other string field as long as the API IDs match.

Hygraph does not check for field value uniqueness while matching. If the target's title or slug must be unique and that value already exists on another entry in the target project, saving the entry can fail. In this case, you need to manually update the title or slug value in the copied content entry in the target project, and then save the content entry.

#What this does not do

  • Copy the entry into the same project. Use Duplicate content instead to create another entry in the same project.
  • Copy assets or variants.
  • Publish the new entry automatically.
  • Copy related entries or schema along with the content. Use Import schema to bring over structure, or Clone your project to copy an entire project.
  • Copy remote fields.
  • Merge into or overwrite an existing entry in the target project.