How to skip (don't update) some fields from existing entity during import if this field already has a value? That for Drupal 8 with modules (migrate, migrate_plus and migrate_tools)

example of an yml I would like:

      plugin: migration_lookup
      migration: users
      no_stub: true
      source: uid
  field_telephone: phone
  field_user_country: pays
  field_adresse/given_name: prenom
      plugin: skip_on_notempty  \--> do not exist
      method: process
      source: \--> actuel value of 'field_adresse/family_name', How to get that ?
      plugin: get
      source: nom
  • I need something similar, updating only certain fields. Nothing built in that I can find. this might be helpful, boylesoftware.com/blog/drupal-8-field-updates – troseman Nov 7 '17 at 22:12
  • Have you found a solution for this? I need to update the value of a text field body/value, but leave the existing summary body/summary as is. The overwrite_properties option does not work here, as it works only for whole fields, not for sub values of a single field. – Hudri Feb 14 '18 at 13:53
  • I don't think using "overwrite_properties" would give the right result - you don't want to overwrite the data if a value already exists right? I can't seem to find a process plugin that does this already so a custom one would be needed. They're easy enough to create. The existing skip_on_value would be a good start: git.drupalcode.org/project/migrate_plus/blob/HEAD/src/Plugin/… – joekers Aug 19 '19 at 14:38

To import only a single field, or possibly multiple, use "overwrite_properties".

overwrite_properties: If the migration has specified a list of properties to be overwritten, clone the row with an empty set of destination values, and re-add only the specified properties.

  plugin: 'entity:node'
    - field_name

Source: Drupal\migrate\Plugin\migrate\destination

  • 3
    Wow, this is a hidden gem, your answer deserves to be marked "accepted". – marcvangend Mar 13 '18 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.